chadaustin / buffer-builder

Haskell library for efficiently building up buffers
BSD 3-Clause "New" or "Revised" License
26 stars 8 forks source link

Utilize Aeson's toEncoding for benchmarks #13

Closed jfischoff closed 7 years ago

jfischoff commented 7 years ago

Implementing a toEncoding method is the way to get Aeson.encode to be faster. With this change the benchmarks I got are:

benchmarking render/bufferbuilder
time                 769.8 μs   (764.1 μs .. 774.6 μs)
                     0.999 R²   (0.998 R² .. 0.999 R²)
mean                 767.3 μs   (758.6 μs .. 777.5 μs)
std dev              32.97 μs   (25.59 μs .. 44.74 μs)
variance introduced by outliers: 34% (moderately inflated)

benchmarking render/aeson
time                 1.049 ms   (1.023 ms .. 1.071 ms)
                     0.996 R²   (0.993 R² .. 0.998 R²)
mean                 1.043 ms   (1.030 ms .. 1.058 ms)
std dev              46.28 μs   (38.64 μs .. 57.35 μs)
variance introduced by outliers: 34% (moderately inflated)

Before render/aeson was ~ 1.6 ms.

This is better apples for apples comparison and shows that bufferbuilder is still considerably faster.

chadaustin commented 7 years ago

Thanks @jfischoff !