nsRange::RegisterSelection shows up in sp3/TodoMVC-Svelte Adding100Items.sync profiles
Categories
(Core :: DOM: Core & HTML, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox114 | --- | fixed |
People
(Reporter: smaug, Assigned: jjaschke)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(1 file)
TodoMVC-Svelte Adding100Items.sync spends some time in creating SelectionListWrapper under nsRange::RegisterSelection.
https://share.firefox.dev/425XlIB
Could we recycle SelectionListWrapper objects, or avoid creating them in the first place or something else...
| Assignee | ||
Comment 1•2 years ago
|
||
From the top of my head I see two options:
- Recycle the instances, just as we do with
nsRange - Change the container from
mozilla::LinkedList<RefPtr<SelectionListWrapper>>tostd::list<RefPtr<Selection>>, the wrapper only exists because of the limitations/design choices ofmozilla::LinkedListin the first place.
If std::list is allowed in mozilla codebase, I'd prefer that solution. Then we can get rid of the wrapper class, and it has reduced complexity to adding some cache of instances... WDYT?
| Reporter | ||
Comment 2•2 years ago
|
||
Why std::list?
LinkedList or DoublyLinkedList should work, no?
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Comment 3•2 years ago
|
||
nsRanges need to keep track of all Selection instances they are in, while maintaining an as-small-as-possible memory footprint.
The approach of using a linked list to store the selection pointers led to a performance regression
because of the necessary allocations of the selection wrapper class.
Since the AutoTArray has an identical size, the list can easily be replaced.
Updated•2 years ago
|
| Assignee | ||
Comment 4•2 years ago
|
||
Re: Comment #1, I opted for option 3: Replace the linked list with an AutoTArray<, 1>, which does not allocate anything for >99% of cases (i.e., only if a range is part of two or more selections) while having the same memory footprint of the LinkedList. This also removes the need of the SelectionListWrapper class.
Updated•2 years ago
|
Comment 6•2 years ago
|
||
| bugherder | ||
Description
•