Open
Conversation
Reitit is very fast, but cannot support all routing structures that other routers like Bidi support, particular regex-based routes.
Member
|
This could be also interesting for frontend use, to optimize the artifact size (#540) because the Trie implementation generates quite a lot of JS code and the performance doesn't matter as much for FE routing. I'll try to review this at some point. |
Contributor
|
Hello [["articles/:year/:month/:slug"
{:name :user/article,
:parameters {:path {:year #"\d{4}"
:month #"\d{2}"
:slug #"[a-z0-9\-]+"}}}]]Given that the regexp guard is defined in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reitit is very fast, but cannot support all routing structures that other routers like Bidi support, particular regex-based routes.
This PR is a proof of concept of one way that a regex based router could work with Reitit.
A more complete version of this PR would compile only the regex based routes to this router, and let the rest of the routes be handled by faster Reitit routers. You could also compile the regex based router to match on a path segment at a time, pruning routes before needing to evaluate a regular expression.
Before I go too much further, I wanted to get some feedback on the syntax for route definition and the overall approach. What do you think about this idea, and the way that path parameters are defined as regex's?
This unoptimized router is about 8-20x slower than regular Reitit in some informal testing.
Fixes #722