-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
util: refactor format method. #12407
Closed
Closed
Commits on Apr 14, 2017
-
util: refactor format method.Performance improved.
Method format refactored to make it more maintenable, replacing the switch by a function factory, that returns the appropiated function given the character (d, i , f, j, s). Also, performance when formatting an string that contains several consecutive % symbols is improved. The test: `const numSamples = 10000000; const strPercents = '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%s%%%%%%%%%%%%%%%%%i%%%%%%%%%%%%%%%%%%%%%%%%%%'; var s; console.time('Percents'); for (let i = 0; i < numSamples; i++) { s = util.format(strPercents, 'test', 12); } console.timeEnd('Percents');` Original time: 28399.708ms After refactor: 23763.788ms Improved: 16%
Configuration menu - View commit details
-
Copy full SHA for 2d11e81 - Browse repository at this point
Copy the full SHA 2d11e81View commit details -
Configuration menu - View commit details
-
Copy full SHA for 181ec8a - Browse repository at this point
Copy the full SHA 181ec8aView commit details -
Configuration menu - View commit details
-
Copy full SHA for aa30bb2 - Browse repository at this point
Copy the full SHA aa30bb2View commit details
Commits on Apr 15, 2017
-
Configuration menu - View commit details
-
Copy full SHA for bf6f8fe - Browse repository at this point
Copy the full SHA bf6f8feView commit details -
Fix lint error: Infix operators must be spaced
Configuration menu - View commit details
-
Copy full SHA for 9d032c2 - Browse repository at this point
Copy the full SHA 9d032c2View commit details
Commits on Apr 16, 2017
-
Configuration menu - View commit details
-
Copy full SHA for da7a15e - Browse repository at this point
Copy the full SHA da7a15eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 78118c7 - Browse repository at this point
Copy the full SHA 78118c7View commit details
Commits on May 31, 2017
-
- Correct whitespace - Static parts of if before unstatic.
Configuration menu - View commit details
-
Copy full SHA for 9f762cf - Browse repository at this point
Copy the full SHA 9f762cfView commit details
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.