Is it possible to keep an object in "fast properties mode" (versus "hash
table mode", as described here:
https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#5-for-in
) when only assigning property values for properties that exist in the
object's prototype?
Here is a small test case:
function applyMask(inputObj, mask) {
var outputObj = Object.create(mask),
maskKeys = Object.keys(mask);
for (var j = 0; j < maskKeys.length; ++j) {
var key = maskKeys[j];
outputObj[key] = inputObj[key];
}
return outputObj;
}
var testMask = {
"key0": null,
"key1": null,
"key2": null,
"key3": null,
"key4": null,
"key5": null,
"key6": null,
"key7": null,
"key8": null,
"key9": null,
"key10": null,
"key11": null,
"key12": null,
"key13": null,
"key14": null
,"key15": null
,"key16": null
,"key17": null
,"key18": null
,"key19": null
};
var testObj = {
"otherProp": "blah blah blah",
"key0": "value",
"key1": "value"
};
var outputObj = applyMask(testObj, testMask);
alert(%HasFastProperties(outputObj));
If I comment out lines "key15" through "key19" within the definition of
testMask, then outputObj is in fast properties mode, but as is, the alert
dialog says false because outputObj is in hash table mode.
I am using Chrome 35.0.1916.153 with v8 3.25.28.18.
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.