3 ms·
How's performance compared to https://github.com/andyfriesen/buffer-builder-aeson https://github.com/andyfriesen/buffer-builder-aeson ? We switched to bb due to
by unhammer 6y ago
How's performance compared to https://github.com/andyfriesen/buffer-builder-aeson https://github.com/andyfriesen/buffer-builder-aeson ? We switched to bb due to memory usage of plain aeson (when encoding big structures as json)
- nikita-volkov 6y agoI've updated the benchmarks to include "buffer-builder". It's not very different from "aeson". jsonifier/1kB mean 2.087 μs ( +- 260.0 ns ) jsonifier/6kB mean 12.33 μs ( +- 222.2 ns ) jsonifier/60kB mean 118.3 μs ( +- 1.991 μs ) jsonifier/600kB mean 1.270 ms ( +- 38.92 μs ) jsonifier/6MB mean 20.53 ms ( +- 1.042 ms ) jsonifier/60MB mean 194.9 ms ( +- 15.04 ms ) aeson/1kB mean 6.542 μs ( +- 199.2 ns ) aeson/6kB mean 31.25 μs ( +- 494.5 ns ) aeson/60kB mean 261.7 μs ( +- 8.044 μs ) aeson/600kB mean 3.395 ms ( +- 114.6 μs ) aeson/6MB mean 30.71 ms ( +- 701.0 μs ) aeson/60MB mean 277.1 ms ( +- 4.776 ms ) lazy-aeson/1kB mean 6.423 μs ( +- 83.69 ns ) lazy-aeson/6kB mean 30.74 μs ( +- 607.0 ns ) lazy-aeson/60kB mean 259.1 μs ( +- 4.890 μs ) lazy-aeson/600kB mean 2.511 ms ( +- 18.71 μs ) lazy-aeson/6MB mean 24.92 ms ( +- 95.36 μs ) lazy-aeson/60MB mean 248.6 ms ( +- 736.6 μs ) buffer-builder/1kB mean 5.512 μs ( +- 77.39 ns ) buffer-builder/6kB mean 30.29 μs ( +- 459.9 ns ) buffer-builder/60kB mean 307.0 μs ( +- 3.640 μs ) buffer-builder/600kB mean 3.001 ms ( +- 75.72 μs ) buffer-builder/6MB mean 33.05 ms ( +- 336.3 μs ) buffer-builder/60MB mean 308.5 ms ( +- 3.489 ms )
- unhammer 6y agoOh, I was thinking more of memory usage (there's a huge difference between plain aeson and buffer-builder there, with large files), but I guess I should just give it a go :-)
- nikita-volkov 6y agoIt might be the case that your memory usage data on "aeson" is outdated. Prior to some later releases it was rendering in two passes: first into AST (the Value type) than from that into ByteString (Builder). It's likely that your extended memory usage was coming from that. Later they had the `Encoding` abstraction introduced to avoid that 2-pass problem. Both "jsonifier" and "buffer-builder" avoid that 2-pass problem by design.