Juan Calderon-Perez

Results 1410 comments of 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: > > ![image](https://private-user-images.githubusercontent.com/48929501/305742148-cf654794-4ca7-42da-b234-e8365e697f4c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDgyODU4NTYsIm5iZiI6MTcwODI4NTU1NiwicGF0aCI6Ii80ODkyOTUwMS8zMDU3NDIxNDgtY2Y2NTQ3OTQtNGNhNy00MmRhLWIyMzQtZTgzNjVlNjk3ZjRjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjE4VDE5NDU1NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUyN2ZjODY0YzZjMzhlMjA2NjlkMGVlNDYyZjExNzM1NWQwZjRlZjVhOGE0MWQ3YTQ2NTQ0YzBiNWZhODQ2MDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.arIxD_Fe_H1sorlSOcoiWrywHwOGKxbK6o8sVd9Pdg4) 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