go-http-routing-benchmark icon indicating copy to clipboard operation
go-http-routing-benchmark copied to clipboard

fix path pattern for aero in Param20 benchmark

Open PratikDeoghare opened this issue 4 years ago • 1 comments

BenchmarkAero_Param5       	17845056	        66.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkAero_Param20      	40719792	        29.2 ns/op	       0 B/op	       0 allocs/op

BenchmarkAero_Param20 took less time than BenchmarkAero_Param5 which made me suspicious. BenchmarkAero_Param20 is using twentyBrace = /{a}/{b}/... so aero treats the path as static. This fixes the benchmark to use the pattern twentyColon = /:a/:b/....

That changes the above benchmarks to

BenchmarkAero_Param5       	17763198	        66.5 ns/op	       0 B/op	       0 allocs/op
BenchmarkAero_Param20      	 6814093	       178 ns/op	       0 B/op	       0 allocs/op

PratikDeoghare avatar Jul 26 '20 20:07 PratikDeoghare

Ah wait! Aero supports 16 params max. I had locally edited branch of Aero.

If this PR merges BenchmarkAero_Param20 will panic.

EDIT: Created an issue https://github.com/aerogo/aero/issues/19

PratikDeoghare avatar Jul 26 '20 20:07 PratikDeoghare