Re: [PATCH v1] lib/vsprintf.c: Even faster decimal conversion

From: Jeff Epler
Date: Thu Mar 12 2015 - 15:16:47 EST


On Wed, Mar 11, 2015 at 12:01:11AM +0100, Rasmus Villemoes wrote:
> Test and verification code on github
> <https://github.com/Villemoes/dec>. It would be nice if someone could
> verify the code on architectures other than x86 - in particular, I
> believe it _should_ work on big-endian, but I have no way of testing
> that. Benchmark numbers would be nice too, of course.

Results from Odroid U3 (32-bit arm exynos 4412) with gcc 4.8.2 after some
trivial modifications (e.g., no -m32) (ubuntu 14.04ish, I think):

Distribution Function nsecs/conv Conv/1 sec
uniform([10, 2^64-1]) linux_put_dec 139.94 7050452
uniform([10, 2^64-1]) rv_put_dec 105.55 9278367
+/- -24.57% +31.60%
3 + neg_binom(0.05) linux_put_dec 69.35 14015175
3 + neg_binom(0.05) rv_put_dec 53.00 18201548
+/- -23.58% +29.87%
3 + neg_binom(0.10) linux_put_dec 48.89 19798285
3 + neg_binom(0.10) rv_put_dec 38.14 25056279
+/- -22.00% +26.56%
3 + neg_binom(0.15) linux_put_dec 40.69 23576136
3 + neg_binom(0.15) rv_put_dec 31.60 30009858
+/- -22.33% +27.29%
3 + neg_binom(0.20) linux_put_dec 37.50 25633406
3 + neg_binom(0.20) rv_put_dec 28.86 32689927
+/- -23.04% +27.53%
3 + neg_binom(0.50) linux_put_dec 28.93 33481454
3 + neg_binom(0.50) rv_put_dec 20.11 45681278
+/- -30.47% +36.44%

Raspberry pi 2 (32-bit ARM BCM2836) with debian jessie armhf (not
raspbian) using a copy of the gcc 4.8.2 binary:
Distribution Function nsecs/conv Conv/1 sec
uniform([10, 2^64-1]) linux_put_dec 301.66 3234768
uniform([10, 2^64-1]) rv_put_dec 224.33 4313939
+/- -25.63% +33.36%
3 + neg_binom(0.05) linux_put_dec 153.66 6221185
3 + neg_binom(0.05) rv_put_dec 119.23 7938177
+/- -22.41% +27.60%
3 + neg_binom(0.10) linux_put_dec 117.47 8040480
3 + neg_binom(0.10) rv_put_dec 91.78 10155002
+/- -21.87% +26.30%
3 + neg_binom(0.15) linux_put_dec 101.14 9254714
3 + neg_binom(0.15) rv_put_dec 79.15 11632168
+/- -21.73% +25.69%
3 + neg_binom(0.20) linux_put_dec 91.49 10152753
3 + neg_binom(0.20) rv_put_dec 71.55 12739461
+/- -21.80% +25.48%
3 + neg_binom(0.50) linux_put_dec 77.28 11790819
3 + neg_binom(0.50) rv_put_dec 57.64 15372506
+/- -25.42% +30.38%

and using 4.9.1:
Distribution Function nsecs/conv Conv/1 sec
uniform([10, 2^64-1]) linux_put_dec 324.76 3009495
uniform([10, 2^64-1]) rv_put_dec 250.85 3870099
+/- -22.76% +28.60%
3 + neg_binom(0.05) linux_put_dec 156.64 6090859
3 + neg_binom(0.05) rv_put_dec 128.18 7364603
+/- -18.17% +20.91%
3 + neg_binom(0.10) linux_put_dec 120.54 7813490
3 + neg_binom(0.10) rv_put_dec 99.73 9320708
+/- -17.26% +19.29%
3 + neg_binom(0.15) linux_put_dec 102.22 9116936
3 + neg_binom(0.15) rv_put_dec 85.22 10778178
+/- -16.63% +18.22%
3 + neg_binom(0.20) linux_put_dec 94.56 9797719
3 + neg_binom(0.20) rv_put_dec 77.60 11750535
+/- -17.94% +19.93%
3 + neg_binom(0.50) linux_put_dec 80.37 11379434
3 + neg_binom(0.50) rv_put_dec 62.16 14339337
+/- -22.67% +26.01%

Verify passed on the odroid, but I got bored and sent this mail before it finished on the rpi2.

Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/