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

Improve route matching (raw) performance #692

Closed
1 task
redbar0n opened this issue Mar 5, 2024 · 4 comments
Closed
1 task

Improve route matching (raw) performance #692

redbar0n opened this issue Mar 5, 2024 · 4 comments

Comments

@redbar0n
Copy link

redbar0n commented Mar 5, 2024

Describe the feature

Hono uses a faster RegExpRouter instead of a Radix Tree based router such as Radix3 which H3 currently uses.

Additional information

  • Would you be willing to help implement this feature?
@pi0
Copy link
Member

pi0 commented Mar 6, 2024

I appreciate your concern about performance and suggestions.

I invite you to check the radix3 benchmarks and see if the raw matcher responsiveness of 7M ops (on a single core of laptop) is less than of your real world usage expectations that might need an alternative method.

There is also an off-topic discussion in unjs/rou3#58 which I will respond in the future.


Generally regarding performances please consider the main bottleneck in any real world server application is not the core or route matcher but user logic and the composition of utilities in which h3 tries to best at.

We can make small adjustments to radix3 to increase benchmark results for specific route conditions but it is just much lower priority comparing to priorities such as ecosystem compatibility.

@pi0 pi0 changed the title Faster router, like Hono (RegExpRouter > Radix3) Improve route matching (raw) performance Mar 6, 2024
@pi0
Copy link
Member

pi0 commented Mar 6, 2024

Also made unjs/rou3#85 as tracker let's move discussion there.

(if you still believe there are strong reasons h3 usage would significantly be different by opting to a different router, we can definitely come back to this 👍🏼 )

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2024
@aquapi
Copy link

aquapi commented Apr 28, 2024

@redbar0n @pi0 you may see hono regex router being faster as the router doesn't parse the params into an object but instead keep it in an array which it can be obtained later by prototype pollution.(c.req.param)

@aquapi
Copy link

aquapi commented Apr 28, 2024

But @medley/router algorithm is still the fastest as of rn, not their implementation though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants