Hi Andrei and David, I tried taking the arithmetic one step further on b59ec01. 0001 uses 64-bit arithmetic for + and - over a four-digit span, and for * on up to four base-10000 digits per operand. Wider inputs use the usual arithmetic with Andrei's local buffer. 0002 uses the space reserved for the sum of squares to hold both signs of a small SUM/AVG accumulator. This follows David's packed-input work and Chenhui Mo's experiments with aggregate transitions.
On an M4 Pro (clang -O2, 500k rows, serial scans, five AB/BA pairs), a*b+a-b > 1000 ran at 1.54x master on small inputs and 1.02x on wide inputs. The slowest individual wide operator was 1.01x. With 1,000 groups, SUM and AVG were about 1.17x and 1.18x. Mixed-sign stddev was 1.00x in isolation (1.00-1.01x on a 16-pair rerun) and 0.94x in one busy rerun. The small expression ran at 1.49x Andrei's v2 and 1.27x David's November 19 patch. David's patch was faster on stddev and by about 5% on wide operands. Would the arithmetic be worth pursuing separately? Regards, Josh Hurst
v1-0002-inline-numeric-sum-avg.patch.no-cfbot
Description: Binary data
v1-0001-short-numeric-arithmetic.patch.no-cfbot
Description: Binary data
