Commit 1214083
authored
ARROW-17135: [C++] Reduce code size in compute/kernels/scalar_compare.cc (apache#13654)
This "leaner" implementation reduces the generated code size of this C++ file from 2307768 bytes to 1192608 bytes in gcc 10.3.0. The benchmarks are also faster (on my avx2 laptop):
before
```
-----------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
-----------------------------------------------------------------------------------------------
GreaterArrayArrayInt64/32768/10000 32.1 us 32.1 us 21533 items_per_second=1020.16M/s null_percent=0.01 size=32.768k
GreaterArrayArrayInt64/32768/100 32.1 us 32.1 us 21603 items_per_second=1019.27M/s null_percent=1 size=32.768k
GreaterArrayArrayInt64/32768/10 32.1 us 32.1 us 21479 items_per_second=1020.82M/s null_percent=10 size=32.768k
GreaterArrayArrayInt64/32768/2 32.0 us 32.0 us 21468 items_per_second=1023.12M/s null_percent=50 size=32.768k
GreaterArrayArrayInt64/32768/1 32.3 us 32.3 us 21720 items_per_second=1013.44M/s null_percent=100 size=32.768k
GreaterArrayArrayInt64/32768/0 31.6 us 31.6 us 21828 items_per_second=1036.94M/s null_percent=0 size=32.768k
GreaterArrayScalarInt64/32768/10000 20.8 us 20.8 us 33461 items_per_second=1.57238G/s null_percent=0.01 size=32.768k
GreaterArrayScalarInt64/32768/100 20.9 us 20.9 us 33625 items_per_second=1.56611G/s null_percent=1 size=32.768k
GreaterArrayScalarInt64/32768/10 20.8 us 20.8 us 33553 items_per_second=1.57338G/s null_percent=10 size=32.768k
GreaterArrayScalarInt64/32768/2 20.9 us 20.9 us 33348 items_per_second=1.5687G/s null_percent=50 size=32.768k
GreaterArrayScalarInt64/32768/1 20.9 us 20.9 us 33419 items_per_second=1.56879G/s null_percent=100 size=32.768k
GreaterArrayScalarInt64/32768/0 20.5 us 20.5 us 34116 items_per_second=1.59837G/s null_percent=0 size=32.768k
```
after
```
-----------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
-----------------------------------------------------------------------------------------------
GreaterArrayArrayInt64/32768/10000 18.1 us 18.1 us 38751 items_per_second=1.81199G/s null_percent=0.01 size=32.768k
GreaterArrayArrayInt64/32768/100 17.5 us 17.5 us 39374 items_per_second=1.86821G/s null_percent=1 size=32.768k
GreaterArrayArrayInt64/32768/10 19.0 us 19.0 us 33941 items_per_second=1.72066G/s null_percent=10 size=32.768k
GreaterArrayArrayInt64/32768/2 18.0 us 18.0 us 39589 items_per_second=1.81817G/s null_percent=50 size=32.768k
GreaterArrayArrayInt64/32768/1 18.1 us 18.1 us 39061 items_per_second=1.80719G/s null_percent=100 size=32.768k
GreaterArrayArrayInt64/32768/0 17.5 us 17.5 us 39813 items_per_second=1.87031G/s null_percent=0 size=32.768k
GreaterArrayScalarInt64/32768/10000 16.3 us 16.3 us 42281 items_per_second=2.01525G/s null_percent=0.01 size=32.768k
GreaterArrayScalarInt64/32768/100 16.5 us 16.5 us 42266 items_per_second=1.98195G/s null_percent=1 size=32.768k
GreaterArrayScalarInt64/32768/10 16.5 us 16.5 us 41872 items_per_second=1.98615G/s null_percent=10 size=32.768k
GreaterArrayScalarInt64/32768/2 16.3 us 16.3 us 42130 items_per_second=2.00447G/s null_percent=50 size=32.768k
GreaterArrayScalarInt64/32768/1 16.2 us 16.2 us 42391 items_per_second=2.02296G/s null_percent=100 size=32.768k
GreaterArrayScalarInt64/32768/0 15.9 us 15.9 us 43498 items_per_second=2.0614G/s null_percent=0 size=32.768k
```
Authored-by: Wes McKinney <wesm@apache.org>
Signed-off-by: Wes McKinney <wesm@apache.org>1 parent 8a4d611 commit 1214083
6 files changed
Lines changed: 226 additions & 71 deletions
File tree
- cpp
- src/arrow
- compute/kernels
- util
- tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 32 | | |
37 | 33 | | |
38 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
967 | | - | |
968 | | - | |
969 | 967 | | |
970 | 968 | | |
971 | 969 | | |
| |||
1009 | 1007 | | |
1010 | 1008 | | |
1011 | 1009 | | |
1012 | | - | |
| 1010 | + | |
1013 | 1011 | | |
1014 | 1012 | | |
1015 | 1013 | | |
| |||
1037 | 1035 | | |
1038 | 1036 | | |
1039 | 1037 | | |
1040 | | - | |
| 1038 | + | |
1041 | 1039 | | |
1042 | 1040 | | |
1043 | 1041 | | |
| |||
1068 | 1066 | | |
1069 | 1067 | | |
1070 | 1068 | | |
1071 | | - | |
| 1069 | + | |
1072 | 1070 | | |
1073 | 1071 | | |
1074 | 1072 | | |
| |||
1104 | 1102 | | |
1105 | 1103 | | |
1106 | 1104 | | |
1107 | | - | |
1108 | | - | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1109 | 1108 | | |
1110 | 1109 | | |
1111 | 1110 | | |
| |||
1135 | 1134 | | |
1136 | 1135 | | |
1137 | 1136 | | |
1138 | | - | |
| 1137 | + | |
1139 | 1138 | | |
1140 | 1139 | | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
1141 | 1144 | | |
1142 | 1145 | | |
1143 | 1146 | | |
| |||
1149 | 1152 | | |
1150 | 1153 | | |
1151 | 1154 | | |
1152 | | - | |
| 1155 | + | |
1153 | 1156 | | |
1154 | 1157 | | |
1155 | 1158 | | |
| |||
1169 | 1172 | | |
1170 | 1173 | | |
1171 | 1174 | | |
1172 | | - | |
| 1175 | + | |
1173 | 1176 | | |
1174 | 1177 | | |
1175 | 1178 | | |
| |||
1249 | 1252 | | |
1250 | 1253 | | |
1251 | 1254 | | |
1252 | | - | |
| 1255 | + | |
1253 | 1256 | | |
1254 | 1257 | | |
1255 | 1258 | | |
| |||
1270 | 1273 | | |
1271 | 1274 | | |
1272 | 1275 | | |
1273 | | - | |
| 1276 | + | |
1274 | 1277 | | |
1275 | 1278 | | |
1276 | 1279 | | |
| |||
1288 | 1291 | | |
1289 | 1292 | | |
1290 | 1293 | | |
1291 | | - | |
| 1294 | + | |
1292 | 1295 | | |
1293 | 1296 | | |
1294 | 1297 | | |
| |||
1312 | 1315 | | |
1313 | 1316 | | |
1314 | 1317 | | |
1315 | | - | |
| 1318 | + | |
1316 | 1319 | | |
1317 | 1320 | | |
1318 | 1321 | | |
| |||
1328 | 1331 | | |
1329 | 1332 | | |
1330 | 1333 | | |
1331 | | - | |
| 1334 | + | |
1332 | 1335 | | |
1333 | 1336 | | |
1334 | 1337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1021 | 1021 | | |
1022 | 1022 | | |
1023 | 1023 | | |
1024 | | - | |
| 1024 | + | |
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
| |||
1046 | 1046 | | |
1047 | 1047 | | |
1048 | 1048 | | |
1049 | | - | |
| 1049 | + | |
1050 | 1050 | | |
1051 | 1051 | | |
1052 | 1052 | | |
| |||
1059 | 1059 | | |
1060 | 1060 | | |
1061 | 1061 | | |
1062 | | - | |
| 1062 | + | |
1063 | 1063 | | |
1064 | 1064 | | |
1065 | 1065 | | |
| |||
1188 | 1188 | | |
1189 | 1189 | | |
1190 | 1190 | | |
1191 | | - | |
| 1191 | + | |
1192 | 1192 | | |
1193 | 1193 | | |
1194 | 1194 | | |
| |||
0 commit comments