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

Minor performance improvement; #16125

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,8 @@ Module._findPath = function(request, paths, isMain) {
if (!filename && rc === 1) { // Directory.
if (exts === undefined)
exts = Object.keys(Module._extensions);
filename = tryPackage(basePath, exts, isMain);
}

if (!filename && rc === 1) { // Directory.
// try it with each of the extensions at "index"
if (exts === undefined)
exts = Object.keys(Module._extensions);
filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain);
filename = tryPackage(basePath, exts, isMain) ||
tryExtensions(path.resolve(basePath, 'index'), exts, isMain); // try it with each of the extensions at "index"
Copy link
Contributor

@Fishrock123 Fishrock123 Oct 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run make lint - it should warn that this line is too long with the comment. :)

}

if (filename) {
Expand Down
4 changes: 2 additions & 2 deletions tools/genv8constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ def out_define():
# 6-character margin, 2-characters + 1 space for each field
idx = 6 + i * 3;
octetstr = line[idx:idx+3]
if not numpattern.match(octetstr):
if curr_octet > octets:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the order of these two?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change because order change not affect logic, and number comparison faster then regex.

break;

if curr_octet > octets:
if not numpattern.match(octetstr):
break;

curr_val += int('0x%s' % octetstr, 16) << (curr_octet * 8);
Expand Down