Open Bug 1430917 Opened 8 years ago Updated 3 years ago

Use a nsTArray for display items instead of a nsTHashtable<nsRefPtrHashKey<DisplayItemData>>

Categories

(Core :: Web Painting, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: jrmuizel, Unassigned)

Details

It seems like we only insert new items, iterate over them, and delete them. If we delete them using nsTArray::SwapRemoveElementAt (this method doesn't exist yet) we will almost certainly be faster than we currently are.
The only real issue with this is that the FrameLayerBuilder::RemoveFrameFromLayerManager caller becomes O(n). That might not matter much in practice. It's also possible that iterating them in this order (rather than the hashtable iterator order) might give us better cache locality, since DisplayItemData objects are allocated into the arena and are hopefully fairly close to each other. This would degrade over time as we swap elements, but we could sort it occasionally if it turns out to matter.
Ah I missed that RemoveElement call, this isn't as good a suggestion as I thought then.
Oh, I think we can fix that one! We already have a pointer to the DisplayItemData object ('data'), so we can probably just flag it as being destroyed and remove it next time we iterate over the list.
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.