3 ms·
I'm curious what they did different than httprouter to remove the allocations, or if they trick the benchmark tool by reusing memory with a pool.
by AYBABTME 12y ago
I'm curious what they did different than httprouter to remove the allocations, or if they trick the benchmark tool by reusing memory with a pool.
- brildum 12y agoLooks like its using a `sync.Pool` to amortize allocations. https://github.com/labstack/echo/blob/master/echo.go#L17 https://github.com/labstack/echo/blob/master/echo.go#L17
- AYBABTME 12y agoI noticed that, I didn't verify where it was used. It's smart, although it cheats the benchmark... kind of. =P I'm always suspicious of usages of `sync.Pool`, it's easy to reuse things that aren't reset properly and end up with subtle coupling between requests.