julienschmidt / go-http-routing-benchmark

Go HTTP request router and web framework benchmark
BSD 3-Clause "New" or "Revised" License
1.65k stars 237 forks source link

fix path pattern for aero in Param20 benchmark #93

Open PratikDeoghare opened 4 years ago

PratikDeoghare commented 4 years ago
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 commented 4 years ago

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