Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: replace goccy with gjson and store response items in a slice (#43)
* perf: replace goccy with gjson and store response items in a slice We're not using the map keys and just iterating on the values so there is no need for a nested struct. We can just flatten the maps and use a slice. Replace go-json with gjson and store the item responses in a slice. The slice was already being reused so there is no additional allocations. This significantly reduce memory usage and allocations. │ before.txt │ after-nojson-perf-final.txt │ │ sec/op │ sec/op vs base │ Appender/NoCompression-20 503.8n ± 6% 476.1n ± 9% -5.49% (p=0.009 n=10) Appender/NoCompressionScaling-20 874.7n ± 15% 848.9n ± 42% ~ (p=0.305 n=10) Appender/BestSpeed-20 793.3n ± 4% 844.8n ± 5% +6.49% (p=0.003 n=10) Appender/BestSpeedScaling-20 789.6n ± 4% 775.7n ± 7% ~ (p=0.075 n=10) Appender/DefaultCompression-20 1.489µ ± 3% 1.450µ ± 4% -2.62% (p=0.003 n=10) Appender/DefaultCompressionScaling-20 1.469µ ± 4% 1.487µ ± 6% ~ (p=0.739 n=10) Appender/BestCompression-20 1.493µ ± 4% 1.473µ ± 7% ~ (p=0.066 n=10) Appender/BestCompressionScaling-20 1.496µ ± 3% 1.460µ ± 4% ~ (p=0.065 n=10) geomean 1.038µ 1.026µ -1.16% │ before.txt │ after-nojson-perf-final.txt │ │ B/s │ B/s vs base │ Appender/NoCompression-20 253.6Mi ± 6% 268.4Mi ± 8% +5.82% (p=0.009 n=10) Appender/NoCompressionScaling-20 146.1Mi ± 13% 150.6Mi ± 74% ~ (p=0.315 n=10) Appender/BestSpeed-20 161.1Mi ± 3% 151.3Mi ± 5% -6.09% (p=0.003 n=10) Appender/BestSpeedScaling-20 161.8Mi ± 4% 164.8Mi ± 8% ~ (p=0.075 n=10) Appender/DefaultCompression-20 85.83Mi ± 3% 88.14Mi ± 4% +2.69% (p=0.004 n=10) Appender/DefaultCompressionScaling-20 87.01Mi ± 3% 85.94Mi ± 7% ~ (p=0.739 n=10) Appender/BestCompression-20 85.61Mi ± 4% 86.81Mi ± 7% ~ (p=0.063 n=10) Appender/BestCompressionScaling-20 85.44Mi ± 3% 87.51Mi ± 4% ~ (p=0.065 n=10) geomean 123.1Mi 124.6Mi +1.18% │ before.txt │ after-nojson-perf-final.txt │ │ B/op │ B/op vs base │ Appender/NoCompression-20 1016.5 ± 0% 333.0 ± 0% -67.24% (p=0.000 n=10) Appender/NoCompressionScaling-20 1026.0 ± 1% 333.0 ± 4% -67.54% (p=0.000 n=10) Appender/BestSpeed-20 1044.0 ± 1% 708.5 ± 3% -32.14% (p=0.000 n=10) Appender/BestSpeedScaling-20 1037.0 ± 1% 695.5 ± 2% -32.93% (p=0.000 n=10) Appender/DefaultCompression-20 1022.5 ± 1% 666.5 ± 6% -34.82% (p=0.000 n=10) Appender/DefaultCompressionScaling-20 1030.0 ± 1% 694.5 ± 5% -32.57% (p=0.000 n=10) Appender/BestCompression-20 1036.5 ± 2% 696.0 ± 2% -32.85% (p=0.000 n=10) Appender/BestCompressionScaling-20 1021.5 ± 2% 699.5 ± 4% -31.52% (p=0.000 n=10) geomean 1.005Ki 577.2 -43.92% │ before.txt │ after-nojson-perf-final.txt │ │ allocs/op │ allocs/op vs base │ Appender/NoCompression-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) Appender/NoCompressionScaling-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) Appender/BestSpeed-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) Appender/BestSpeedScaling-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) Appender/DefaultCompression-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) Appender/DefaultCompressionScaling-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) Appender/BestCompression-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) Appender/BestCompressionScaling-20 6.000 ± 0% 2.000 ± 0% -66.67% (p=0.000 n=10) geomean 6.000 2.000 -66.67% * refactor: wrap read error and remove comments * refactor: remove minimal bulk response and use slice everywhere
- Loading branch information