-
Notifications
You must be signed in to change notification settings - Fork 11
Optimize even more #2
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
You'd probably get even better results if you remove the function calls within loop. You have to be careful about inserted identifiers and such, but it should be fairly easy to generate this:
// Compiled with faster.js
const arr = [1, 2, 3];
const results = [];
for (let _i = 0; _i < arr.length; _i++) {
results.push(2 * arr[_i]);
}Maybe you could even preallocate results in case of .map based on arr.length, but aint sure what's better in majority of use cases. Maybe you could decide about this based on this comment from v8 team.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request