Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement extra parameters #269

Merged
merged 1 commit into from
Jan 31, 2024
Merged

Implement extra parameters #269

merged 1 commit into from
Jan 31, 2024

Conversation

lcobucci
Copy link
Collaborator

@lcobucci lcobucci commented Jan 8, 2024

This introduces the possibility of providing extra parameters during route registration (such as route name) and by default registers the unparsed route as an item on the list.

Fixes #225
Fixes #234

Alternative to #265

@lcobucci lcobucci added this to the 2.0.0 milestone Jan 8, 2024
@lcobucci lcobucci self-assigned this Jan 8, 2024
@lcobucci
Copy link
Collaborator Author

lcobucci commented Jan 8, 2024

Still a draft because I'm looking for ways to reduce the performance impact (~20% on static routes 😭):

benchmark subject set mode
RoutingWithRealLifeExampleBench staticFirstRoute group_count 0.172μs +19.54%
RoutingWithRealLifeExampleBench staticFirstRoute char_count 0.176μs +22.24%
RoutingWithRealLifeExampleBench staticFirstRoute group_pos 0.178μs +23.99%
RoutingWithRealLifeExampleBench staticFirstRoute mark 0.172μs +19.54%
RoutingWithRealLifeExampleBench dynamicFirstRoute group_count 0.593μs +2.94%
RoutingWithRealLifeExampleBench dynamicFirstRoute char_count 0.661μs +3.21%
RoutingWithRealLifeExampleBench dynamicFirstRoute group_pos 0.632μs +9.85%
RoutingWithRealLifeExampleBench dynamicFirstRoute mark 0.655μs +2.64%
RoutingWithRealLifeExampleBench staticLastRoute group_count 0.176μs +24.33%
RoutingWithRealLifeExampleBench staticLastRoute char_count 0.173μs +19.80%
RoutingWithRealLifeExampleBench staticLastRoute group_pos 0.172μs +19.68%
RoutingWithRealLifeExampleBench staticLastRoute mark 0.172μs +19.46%
RoutingWithRealLifeExampleBench dynamicLastRoute group_count 0.922μs -4.98%
RoutingWithRealLifeExampleBench dynamicLastRoute char_count 0.838μs +1.47%
RoutingWithRealLifeExampleBench dynamicLastRoute group_pos 0.967μs -15.99%
RoutingWithRealLifeExampleBench dynamicLastRoute mark 0.782μs -6.16%
RoutingWithRealLifeExampleBench staticInvalidMethod group_count 1.510μs -4.46%
RoutingWithRealLifeExampleBench staticInvalidMethod char_count 1.523μs -14.14%
RoutingWithRealLifeExampleBench staticInvalidMethod group_pos 1.608μs -0.82%
RoutingWithRealLifeExampleBench staticInvalidMethod mark 1.421μs -15.50%
RoutingWithRealLifeExampleBench dynamicInvalidMethod group_count 1.941μs +10.48%
RoutingWithRealLifeExampleBench dynamicInvalidMethod char_count 2.113μs +12.80%
RoutingWithRealLifeExampleBench dynamicInvalidMethod group_pos 1.794μs -1.09%
RoutingWithRealLifeExampleBench dynamicInvalidMethod mark 1.792μs -9.84%
RoutingWithRealLifeExampleBench unknownRoute group_count 1.502μs -6.78%
RoutingWithRealLifeExampleBench unknownRoute char_count 1.669μs -5.45%
RoutingWithRealLifeExampleBench unknownRoute group_pos 1.550μs -10.12%
RoutingWithRealLifeExampleBench unknownRoute mark 1.511μs +1.76%
RoutingWithRealLifeExampleBench longestRoute group_count 1.194μs +3.16%
RoutingWithRealLifeExampleBench longestRoute char_count 1.309μs +18.75%
RoutingWithRealLifeExampleBench longestRoute group_pos 1.161μs +2.56%
RoutingWithRealLifeExampleBench longestRoute mark 1.206μs +4.86%
RouteRegistrationBench groupCount 90.944μs +8.19%
RouteRegistrationBench charCount 91.371μs +3.69%
RouteRegistrationBench groupPos 96.773μs +19.07%
RouteRegistrationBench mark 90.552μs +8.97%
RoutingWithManyRoutesBench staticFirstRoute group_count 0.184μs +27.76%
RoutingWithManyRoutesBench staticFirstRoute char_count 0.184μs +27.75%
RoutingWithManyRoutesBench staticFirstRoute group_pos 0.184μs +27.76%
RoutingWithManyRoutesBench staticFirstRoute mark 0.184μs +27.76%
RoutingWithManyRoutesBench dynamicFirstRoute group_count 0.571μs +4.71%
RoutingWithManyRoutesBench dynamicFirstRoute char_count 0.681μs +0.61%
RoutingWithManyRoutesBench dynamicFirstRoute group_pos 0.560μs +0.13%
RoutingWithManyRoutesBench dynamicFirstRoute mark 0.651μs -1.22%
RoutingWithManyRoutesBench staticLastRoute group_count 0.185μs +22.96%
RoutingWithManyRoutesBench staticLastRoute char_count 0.184μs +27.79%
RoutingWithManyRoutesBench staticLastRoute group_pos 0.184μs +22.43%
RoutingWithManyRoutesBench staticLastRoute mark 0.184μs +27.86%
RoutingWithManyRoutesBench dynamicLastRoute group_count 22.790μs -5.65%
RoutingWithManyRoutesBench dynamicLastRoute char_count 20.572μs +8.80%
RoutingWithManyRoutesBench dynamicLastRoute group_pos 22.365μs -2.40%
RoutingWithManyRoutesBench dynamicLastRoute mark 19.276μs +10.44%
RoutingWithManyRoutesBench staticInvalidMethod group_count 4.309μs +4.21%
RoutingWithManyRoutesBench staticInvalidMethod char_count 3.216μs +3.70%
RoutingWithManyRoutesBench staticInvalidMethod group_pos 4.261μs +2.34%
RoutingWithManyRoutesBench staticInvalidMethod mark 2.650μs -2.72%
RoutingWithManyRoutesBench dynamicInvalidMethod group_count 23.230μs +1.07%
RoutingWithManyRoutesBench dynamicInvalidMethod char_count 21.362μs +4.33%
RoutingWithManyRoutesBench dynamicInvalidMethod group_pos 23.230μs +0.13%
RoutingWithManyRoutesBench dynamicInvalidMethod mark 18.139μs +0.53%
RoutingWithManyRoutesBench unknownRoute group_count 5.241μs -4.72%
RoutingWithManyRoutesBench unknownRoute char_count 3.663μs +3.47%
RoutingWithManyRoutesBench unknownRoute group_pos 5.324μs +0.40%
RoutingWithManyRoutesBench unknownRoute mark 3.064μs +8.72%

@lcobucci
Copy link
Collaborator Author

The performance impact is inevitable due to the need to return the extra parameters on the result.
I'll look into optimising things more as soon as we have a more stable API.

This introduces the possibility of providing extra parameters during
route registration (such as route name) and by default registers the
unparsed route an item on the list.

Signed-off-by: Luís Cobucci <[email protected]>
@lcobucci lcobucci merged commit 5db30ca into master Jan 31, 2024
32 of 33 checks passed
@lcobucci lcobucci deleted the extra-parameters branch January 31, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggested add the route name Active route pattern
1 participant