-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from yookoala/fix/regex-reuse-issue
Improve performance by using copy instead of recompile
- Loading branch information
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
bd30ad8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yookoala: sorry to nitpick again, but
Copy()
of the regexp is not necessary (it's marked as deprecated), as using the regexp doesn't modify its internal state. They were designed to be compiled and used over and over again :) Only exception would be if you modified the regexp's settings per request , but AFAIK callingLongest()
is the only setting you can modify after compiling and that's not done here.bd30ad8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're fixing that, there's another place where regexp is compiled for every request:
gofast/session.go
Line 338 in b30b52d
bd30ad8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm currently rethinking the entire routing process.
I didn't want to make it too complicated in my first go. But seems more people is using this than I expected. So I'd probably spend some more times on it.