On Wednesday, 26 February 2020 at 19:44:05 UTC, Bruce Carneal
wrote:
On Wednesday, 26 February 2020 at 13:50:11 UTC, Basile B. wrote:
On Wednesday, 26 February 2020 at 00:50:35 UTC, Basile B.
wrote:
...
foreach (i; 0 .. count)
sum += funcs[func](i);
The input stream is highly predictable and strongly skewed
towards higher digits.
The winning function implementation lines up with that
distribution. It would not fare as well with higher entropy
input.
Using sorted equi-probable inputs (N 1 digit numbers, N 2 digit
numbers, ...) decimalLength9_0 beats a simple branchless
implementation by about 10%.
After shuffling the input, branchless wins by 2.4X (240%).