thriftrw / thriftrw-node

A thrift binary encoding library using bufrw
MIT License
57 stars 25 forks source link

Less allocations #109

Closed rf closed 8 years ago

rf commented 8 years ago

This isn't quite zero alloc but it's definitely less allocations. I might try and get this branch faster before merging, but right now it passes all tests and does show a performance gain, though it wasn't the 2x improvement I was hoping for.

after, and with bufrw 1.2.0:

p25 1.28µs p50 1.35µs p75 1.53µs p90 1.71µs stddev 37.5ns q3-q1/2  372ns 0 thrift
p25 2.10µs p50 2.22µs p75 2.61µs p90 2.77µs stddev 61.0ns q3-q1/2  355ns 0 json
p25 2.56µs p50 2.74µs p75 3.22µs p90 3.35µs stddev 90.5ns q3-q1/2  422ns 1 thrift
p25 3.55µs p50 3.81µs p75 4.50µs p90 4.60µs stddev  131ns q3-q1/2  671ns 1 json
p25 14.2µs p50 14.9µs p75 16.5µs p90 17.8µs stddev  355ns q3-q1/2 1.60µs 10 thrift
p25 13.6µs p50 14.1µs p75 15.5µs p90 17.0µs stddev  280ns q3-q1/2 2.13µs 10 json
p25  132µs p50  138µs p75  144µs p90  154µs stddev 2.98µs q3-q1/2 9.74µs 100 thrift
p25  119µs p50  126µs p75  132µs p90  140µs stddev 3.18µs q3-q1/2 8.95µs 100 json
p25 1.37ms p50 1.39ms p75 1.42ms p90 1.43ms stddev 11.8µs q3-q1/2 37.2µs 1000 thrift
p25 1.26ms p50 1.29ms p75 1.31ms p90 1.35ms stddev 16.0µs q3-q1/2 40.5µs 1000 json
p25 13.4ms p50 13.5ms p75 13.6ms p90 13.7ms stddev 32.8µs q3-q1/2  151µs 10000 thrift
p25 17.6ms p50 17.6ms p75 17.6ms p90 17.7ms stddev 0.00ns q3-q1/2 91.4µs 10000 json

before, and with bufrw 1.1.0:

p25 1.34µs p50 1.38µs p75 1.45µs p90 1.70µs stddev 18.3ns q3-q1/2  309ns 0 thrift
p25 2.14µs p50 2.28µs p75 2.75µs p90 2.84µs stddev 72.0ns q3-q1/2  377ns 0 json
p25 3.08µs p50 3.28µs p75 3.90µs p90 4.01µs stddev  105ns q3-q1/2  482ns 1 thrift
p25 3.59µs p50 3.75µs p75 4.27µs p90 4.65µs stddev 80.5ns q3-q1/2  781ns 1 json
p25 17.4µs p50 18.5µs p75 20.1µs p90 21.7µs stddev  528ns q3-q1/2 1.97µs 10 thrift
p25 13.5µs p50 14.1µs p75 15.7µs p90 16.9µs stddev  347ns q3-q1/2 1.52µs 10 json
p25  162µs p50  166µs p75  173µs p90  180µs stddev 2.08µs q3-q1/2 8.50µs 100 thrift
p25  117µs p50  122µs p75  128µs p90  134µs stddev 2.72µs q3-q1/2 8.12µs 100 json
p25 1.66ms p50 1.70ms p75 1.72ms p90 1.77ms stddev 18.9µs q3-q1/2 54.3µs 1000 thrift
p25 1.23ms p50 1.27ms p75 1.29ms p90 1.32ms stddev 19.4µs q3-q1/2 52.9µs 1000 json
p25 17.2ms p50 17.2ms p75 17.2ms p90 17.3ms stddev 0.00ns q3-q1/2 81.9µs 10000 thrift
p25 16.7ms p50 16.7ms p75 16.7ms p90 16.8ms stddev 0.00ns q3-q1/2  121µs 10000 json

r @kriskowal @jcorbin @Raynos

jcorbin commented 8 years ago

:ok: with me since the tests green, nice benchmark numbers

kriskowal commented 8 years ago

:ok: