-
Notifications
You must be signed in to change notification settings - Fork 688
Closed
Labels
ecma builtinsRelated to ECMA built-in routinesRelated to ECMA built-in routinesenhancementAn improvementAn improvement
Milestone
Description
Built-in functions that require us to iterate over Arrays currently do so by iterating over the whole length of the array. Most of the time this is necessary, but there are some function where we can get away with only iterating over the defined properties. This should be done wherever possible, since this could greatly decrease runtime in case the array is sparse.
For example:
var a = new Array ();
a[100000] = 1;
a[1000000] = 2;
a.sort ();
Functions where this could be done:
- Array.prototype.indexOf
- Array.prototype.lastIndexOf
- Array.prototype.shift
- Array.prototype.unshift
- Array.prototype.sort
Metadata
Metadata
Assignees
Labels
ecma builtinsRelated to ECMA built-in routinesRelated to ECMA built-in routinesenhancementAn improvementAn improvement