Skip to content

Suggestion: Improve performance through regex memoization #183

Open
@daniellubovich

Description

@daniellubovich

Hey! Recently I've started to hit some performance bottlenecks that seem to be stemming at least partially from route-recognizer. It might be the case that the root of the issue is due to either 1) My application being too large, or 2) ember-source not using the recognizer in the most optimal way, so take whatever I suggest with a grain of salt.

I ran some performance checks when running an acceptance test in Ember. This test loads up all of our routes (we have a lot) at the beginning of the test, and it takes a significant chunk of time. Around 20%.

image

While I do think there could be some optimization elsewhere - it seems like an easy improvement might be to include some memoization for the regex functions in route-recognizer? I could be overlooking some possible downsides here, and I'm not super familiar with this library. Does this seem like a reasonable suggestion?

I did some testing with a local fork and it seemed to have significant improvements on my test execution time. FWIW if this suggestion gets any traction, I'm happy to do the work to implement it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions