Agniva De Sarker
2dba5dbf86
MM-21368: Optimize MapStringsToQueryParams (#13601)
- Use strings.Builder which minimizes allocations.
- Avoid fmt.Sprintf which is slower than simple string concat.
Results:
name old time/op new time/op delta
MapStringsToQueryParams/one_item-8 512ns ± 2% 377ns ± 1% -26.27% (p=0.000 n=10+9)
MapStringsToQueryParams/multiple_items-8 858ns ± 5% 748ns ± 2% -12.82% (p=0.000 n=10+9)
name old alloc/op new alloc/op delta
MapStringsToQueryParams/one_item-8 456B ± 0% 384B ± 0% -15.79% (p=0.000 n=10+9)
MapStringsToQueryParams/multiple_items-8 608B ± 0% 592B ± 0% -2.63% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
MapStringsToQueryParams/one_item-8 8.00 ± 0% 6.00 ± 0% -25.00% (p=0.000 n=10+10)
MapStringsToQueryParams/multiple_items-8 12.0 ± 0% 12.0 ± 0% ~ (all equal)
2020-01-09 07:44:01 -08:00
..
2019-11-28 14:39:38 +01:00
2020-01-09 09:57:28 +01:00
2020-01-09 07:44:01 -08:00
2020-01-09 09:57:28 +01:00
2019-11-29 12:59:40 +01:00
2020-01-08 11:31:10 +01:00
2020-01-08 11:31:10 +01:00