-
Type:
Sub-task
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 8
-
Component/s: core-libs
-
None
-
b98
Calling ScriptObject.setProto() is quite expensive. One expensive part is invalidating the object's property map, which involves a WeakHashMap lookup in PropertyMap.checkProtoHistory().
Invaliding the property map is necessary if the property map may be in use with other prototypes. However, many built-in objects including arrays (in fact all built-ins except for Object) are always constructed with the same combination of prototype and property map.
In this case we can significantly improve object creation overhead by providing a way to directly set both prototype and property map.
Invaliding the property map is necessary if the property map may be in use with other prototypes. However, many built-in objects including arrays (in fact all built-ins except for Object) are always constructed with the same combination of prototype and property map.
In this case we can significantly improve object creation overhead by providing a way to directly set both prototype and property map.