This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 681
Conversation
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
davidmurdoch
changed the title
optimize account init logging
perf: optimize account init logging
May 5, 2023
Deploying with Cloudflare Pages
|
jeffsmale90
reviewed
Jun 19, 2023
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.
Maybe just over optimising here, but these look like some simple changes to bundle together.
const logs = []; | ||
logs.push(""); | ||
logs.push("Available Accounts"); | ||
logs.push("=================="); | ||
if (addresses.length > 0) { | ||
addresses.forEach(function (address, index) { | ||
const balance = accounts[address].balance; | ||
addresses.forEach(([address, account], index) => { |
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 checkout out this for
benchmark: https://github.com/LeanyLabs/js-array-performance and reran with node 20.2.0 and found that forEach
is even more slow compared with for of
than it was in node 14.
Array.forEach x 130 ops/sec ±0.22% (84 runs sampled)
for of x 529 ops/sec ±0.57% (94 runs sampled)
While we are here, do you think it's worthwhile updating these Array.forEach
s to for....of
s?
I made those additional optimizations in a separate review here: #4446 incase you don't like them. |
jeffsmale90
approved these changes
Jun 21, 2023
This was referenced Sep 23, 2023
This was referenced Nov 23, 2023
This was referenced Dec 2, 2023
This was referenced Dec 12, 2023
This was referenced Dec 31, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.