-
Notifications
You must be signed in to change notification settings - Fork 688
Conversation
Deploying with
|
Latest commit: |
e3476b4
|
Status: | ✅ Deploy successful! |
Preview URL: | https://d62f6f24.ganache.pages.dev |
Branch Preview URL: | https://optimize-accounts.ganache.pages.dev |
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. |
No description provided.