Juan Calderon-Perez
Juan Calderon-Perez
Yeah, this definitely needs a different approach between Sprintf + Regex it will make the middleware super slow.
> [#2860 (comment)](https://github.com/gofiber/fiber/issues/2860#issuecomment-1949132294) > > ```go > prefixCount := len(utils.TrimRight(c.Route().Path, '/')) > if len(c.Path()) >= prefixCount { > switch c.Path()[prefixCount:] { > case cfg.ReadinessEndpoint: > return isReadyHandler(c) > case cfg.LivenessEndpoint:...
> @ReneWerner87 yours fail in the strict routing test but @gaby solution passed it no prob, benchmark results: > >  Hmmm that still drops performance in half. The ns/op...
@luk3skyw4lker Try this: ```go // Find the start of the last segment lastSlashIndex := strings.LastIndex(c.Path(), "/") lastSegment := c.Path()[lastSlashIndex+1:] // +1 to skip the slash itself // Direct string comparison...
> @gaby without the +1 looks better, because then we wouldn't have to trim the already set up config to remove the slashes, passed it fine and it looks very...
> Using switch in @gaby solution makes it go back to around 190 ns/op Wow!
@luk3skyw4lker We definitely need a test that checks both `/livez` and `/livez/`.
What's the benchmark difference between using this and the previous implementation?
Wait for #2842 to get merged. I suspect a lot of warnings will pop up
Ping @gofiber/maintainers