aboutsummaryrefslogtreecommitdiffstats
path: root/erts/example/pg_sync.erl
diff options
context:
space:
mode:
authorDmytro Lytovchenko <[email protected]>2016-01-21 17:20:47 +0100
committerDmytro Lytovchenko <[email protected]>2016-02-02 11:32:58 +0100
commitc96b6c2f58642b457d806c0a8a5bed03d16e35f1 (patch)
tree6b70c74b6d5e96559811589c4fb5ccef19ac3d6d /erts/example/pg_sync.erl
parent0236a875929729eca1933cbb854267f584734b26 (diff)
downloadotp-c96b6c2f58642b457d806c0a8a5bed03d16e35f1.tar.gz
otp-c96b6c2f58642b457d806c0a8a5bed03d16e35f1.tar.bz2
otp-c96b6c2f58642b457d806c0a8a5bed03d16e35f1.zip
Better list_to_integer
Now tries to use whole width of signed long (Sint) and this halves amount of multiplications needed to parse long integers. New code is 2-3 times faster than the old code for large inputs (tens and hundreds of digits), behavior should not change for small inputs. Test ran 10k times with GC forced between attempts. Was (R17): 720 el base 10: 0.14682 sec; base 16: 0.192722 sec; base 36: 0.337118 sec. 2800 el base 10: 1.794133 sec; base 16: 2.735106 sec; base 36: 4.761108 sec. 6500 el base 10: 9.316434 sec; base 16: 14.109469 sec; base 36: 25.319263 sec. Now (R19 Dev) 720 el base 10: 0.10265 sec; base 16: 0.10851 sec; base 36: 0.160478 sec. 2800 el base 10: 1.002793 sec; base 16: 1.360649 sec; base 36: 2.174309 sec. 6500 el base 10: 4.722197 sec; base 16: 6.60522 sec; base 36: 10.552795 sec. Added test for corner cases and sign bit corruption. Replaced macros with inline and hid it inside C file to not pollute global namespace Old bug in #define LG2_LOOKUP: Replaced with inline function and table recalculated for all bases 2 to 36 (was 2 to 64)
Diffstat (limited to 'erts/example/pg_sync.erl')
0 files changed, 0 insertions, 0 deletions