(In reply to Oriol Brufau [:Oriol] from comment #0) > It seems to me that tabs could track the other tabs that they own, then only these could be iterated. This sounds like it'd have a caching problem (ie when do we clear things from the other owned tabs list). The other solution I see is separating out the "clear owner tab" bit into a helper that takes a set of tabs about to be removed, and then iterates the list only once, which would produce linear + set lookup time behaviour, which is probably `N log N` or similar, which is probably sufficient. Do you have a performance profile showing what the practical impact of this is when you close 999 tabs or something? Half a million iterations sounds bad but I do wonder if it's the worst thing happening in this situation.
Bug 1811115 Comment 1 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Oriol Brufau [:Oriol] from comment #0) > It seems to me that tabs could track the other tabs that they own, then only these could be iterated. This sounds like it'd have a caching problem (ie when do we clear things from the other owned tabs list). The other solution I see is separating out the "clear owner tab" bit into a helper that takes a set of tabs about to be removed, and then iterates the list only once, which would produce linear + set lookup time behaviour, which is probably `O(N log N)` or similar, which is probably sufficient. Do you have a performance profile showing what the practical impact of this is when you close 999 tabs or something? Half a million iterations sounds bad but I do wonder if it's the worst thing happening in this situation.