Open Bug 1339265 Opened 7 years ago Updated 2 months ago

Implement sparse elements storage for objects


(Core :: JavaScript Engine, task, P3)





(Reporter: evilpie, Unassigned)


(Blocks 4 open bugs)


Nowadays every native object can have dense elements and that is great. 

However as soon as some an object becomes sparse, because we added indexed properties to the shape, our performance falls of a cliff. Every other engine has a sparse elements storage, which they can use instead of dense elements storage to optimize those cases. I imagine we would basically have a HashMap of PropertyDescriptors, which will be stored at the NativeObject::elements_ when the object is sparse.

Implementing this is probably going to be a significant amount of work, but I think it could be worth it. Both Google Sheets and Facebook use objects as a hashmap with sparse array indexes.

Additionally we can't use dense elements for elements that are non-plain properties, so we would have the opportunity to optimize the case where for example a single element is non-writable, or a getter.
Blocks: 1500481
Severity: normal → S3
Blocks: 1851371
Blocks: 1853510
Type: defect → task
You need to log in before you can comment on or make changes to this bug.