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

module: cache regular expressions #3869

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
5 participants
@evanlucas
Copy link
Member

commented Nov 17, 2015

None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

module: cache regular expressions
None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

@evanlucas evanlucas added the module label Nov 17, 2015

@cjihrig

This comment has been minimized.

Copy link
Contributor

commented Nov 17, 2015

LGTM

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Nov 17, 2015

@ronkorving

This comment has been minimized.

Copy link
Contributor

commented Nov 17, 2015

Wow, that gives a measurable improvement? I'm kinda surprised V8 doesn't just keep this in cache (it has a compiled regex cache, right?).

@jasnell

This comment has been minimized.

Copy link
Member

commented Nov 17, 2015

Nice!
LGTM

@jasnell

This comment has been minimized.

Copy link
Member

commented Nov 17, 2015

out of curiosity, @evanlucas did you have benchmark numbers that show the improvement?

evanlucas added a commit that referenced this pull request Nov 17, 2015

module: cache regular expressions
None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

PR-URL: #3869
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell

This comment has been minimized.

Copy link
Member

commented Nov 17, 2015

Landed in 4fed62c

@evanlucas

This comment has been minimized.

Copy link
Member Author

commented Nov 17, 2015

Sure, here are a couple runs

$ ./node benchmark/compare.js ./node ./node_before -- misc module-loader
running ./node
misc/module-loader.js
running ./node_before
misc/module-loader.js

misc/module-loader.js thousands=50: ./node: 5.0003 ./node_before: 4.7087 . 6.19%

$ ./node benchmark/compare.js ./node ./node_before -- misc module-loader
running ./node
misc/module-loader.js
running ./node_before
misc/module-loader.js

misc/module-loader.js thousands=50: ./node: 5.0322 ./node_before: 4.7896 . 5.06%
@ronkorving

This comment has been minimized.

Copy link
Contributor

commented Nov 17, 2015

Higher is better, right? :)

evanlucas added a commit that referenced this pull request Nov 17, 2015

module: cache regular expressions
None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

PR-URL: #3869
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

evanlucas added a commit that referenced this pull request Dec 1, 2015

module: cache regular expressions
None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

PR-URL: #3869
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

evanlucas added a commit that referenced this pull request Dec 4, 2015

module: cache regular expressions
None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

PR-URL: #3869
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

@jasnell jasnell referenced this pull request Dec 17, 2015

Closed

Release 4.2.4 Planning #4321

evanlucas added a commit that referenced this pull request Dec 17, 2015

module: cache regular expressions
None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

PR-URL: #3869
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

evanlucas added a commit that referenced this pull request Dec 23, 2015

module: cache regular expressions
None of these regular expressions will change, so there is no need to
generate them every time in hot code paths.

Provides a small performance improvement in module loading. (5-10%)

PR-URL: #3869
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.