-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
What problem does this feature solve?
Increase performance during Vue preparations. During Vue initialization process there is a function makeMap, which splits string of items into array and then create Map-like object. But during for-loop every iteration it checks list.length value, which can be stored in separate variable before running for-loop. For arrays of 40 this can improve performance
What does the proposed API look like?
function makeMap (str, expectsLowerCase) {
var map = Object.create(null);
var list = str.split(',');
var listLength = list.length; // <-- here it is
for (var i = 0; i < listLength; i++) {
map[list[i]] = true;
}
return expectsLowerCase ? function (val) { return map[val.toLowerCase()] } : function (val) { return map[val] }
}Metadata
Metadata
Assignees
Labels
No labels