Closed Bug 1808726 Opened 2 years ago Closed 2 years ago

Avoid gBrowser.visibleTabs in _mouseenter()

Categories

(Firefox :: Tabbed Browser, task)

task

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: Oriol, Assigned: Oriol)

References

(Blocks 1 open bug)

Details

(Keywords: perf:frontend)

Attachments

(1 obsolete file)

gBrowser.visibleTabs is slow when there are lots of tabs.

If e.g. a thousand of tabs are removed, _setPositionalAttributes() will be called lots of times, and if the user is hovering a tab, it will keep calling _mouseenter().

Blocks: 1808719
Keywords: perf:frontend
Type: enhancement → task

This patch won't improve performance by itself, since visibleTabs will
have been likely computed and cached in _setPositionalAttributes, but
it's the first step towards avoiding that work in hot code paths.

Note that previousVisibleTab and nextVisibleTab are not cached, so on
the worst case they may keep iterating several hidden tabs, but I think
it's fine given that most tabs are probably visible, and a cache may be
considered in the future. Also note that existing code was using linear
indexOf which wasn't great either.

Assignee: nobody → oriol-bugzilla
Status: NEW → ASSIGNED
Attachment #9310876 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: