sqlx
sqlx copied to clipboard
Reduce allocations in fixBound
Reduces allocations by initializing bytes.Buffer
with correct target capacity.
benchmark old ns/op new ns/op delta
BenchmarkFixBound10-8 346 324 -6.42%
BenchmarkFixBound100-8 1410 1170 -17.02%
benchmark old allocs new allocs delta
BenchmarkFixBound10-8 4 3 -25.00%
BenchmarkFixBound100-8 7 3 -57.14%
benchmark old bytes new bytes delta
BenchmarkFixBound10-8 354 273 -22.88%
BenchmarkFixBound100-8 3294 2082 -36.79%
@jmoiron WDYT about merging this?
@jmoiron WDYT about merging this?