flumedb / flumelog-offset

MIT License
10 stars 8 forks source link

Faster json parse. buffer.tostring is faster than feeding it buffer directly #11

Closed arj03 closed 6 years ago

arj03 commented 6 years ago

See https://github.com/arj03/test-json-parse

dominictarr commented 6 years ago

wow, it's surprising to me this actually makes a difference! I'm seeing an obvious difference on the append measurement:

master:

name, ops/second, mb/second, ops, total-mb, seconds
append, 176919.532, 22.387, 1769903, 223.964, 10.004
stream, 96463.56, 12.206, 964925, 122.101, 10.003
stream no cache, 113168.583, 14.32, 1131799, 143.218, 10.001
stream10, 539149.885, 68.223, 5392038, 682.301, 10.001
random, 39713.028, 5.025, 397170, 50.258, 10.001

faster-json-parse

name, ops/second, mb/second, ops, total-mb, seconds
append, 207940.453, 26.307, 2081276, 263.314, 10.009
stream, 96525.889, 12.212, 965645, 122.169, 10.004
stream no cache, 116341.865, 14.719, 1163535, 147.205, 10.001
stream10, 537890.71, 68.052, 5379445, 680.589, 10.001
random, 38379.262, 4.855, 383831, 48.561, 10.001

17% faster! ps, if you are making a performance related PR I'd really like to know how much difference it makes, and to what.

dominictarr commented 6 years ago

merged into 3.3.1