json-canon icon indicating copy to clipboard operation
json-canon copied to clipboard

[rust] object pooling

Open ahdinosaur opened this issue 2 years ago • 0 comments

inspired by https://www.reddit.com/r/rust/comments/ozpspr/improved_my_base64_encoders_performance_3x_by/,

i tried to re-use the many ObjectEntry objects that get created (and their byte Vec<u8>'s) using a pool.

benchmarks look very promising!

                        time:   [13.003 µs 13.027 µs 13.061 µs]
                        thrpt:  [76.564 Kelem/s 76.761 Kelem/s 76.904 Kelem/s]
                 change:
                        time:   [-39.290% -39.190% -39.087%] (p = 0.00 < 0.05)
                        thrpt:  [+64.169% +64.447% +64.716%]

ahdinosaur avatar May 23 '23 10:05 ahdinosaur