As expected, implementing the proposed changes reduced the time spent in `Highlight::Add()` from ~1sec (test case above, on my machine) to ~300ms. The remaining time is mostly spent in `NotifySelectionListener()` now. [Try run](https://treeherder.mozilla.org/#/jobs?repo=try&revision=9ccd03d89841ac8b0cbf1d8868ea2061cbbe85d0) for part 1. Additionally, there was a small bug which caused `NotifySelectionListener()` to notify for `eNormal` selections even when triggered by highlight selections. This change reduced the `Highlight::Add()` call even further (~200ms now). [Try run](https://treeherder.mozilla.org/jobs?repo=try&revision=4cc7319a0b7ae8ddc2d84bc0f27a0e67d569b20a) for part 2.
Bug 1892589 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.
As expected, implementing the proposed changes reduced the time spent in `Highlight::Add()` from ~1sec (test case above, on my machine) to ~300ms. The remaining time is mostly spent in `NotifySelectionListener()` now. ~~[Try run](https://treeherder.mozilla.org/#/jobs?repo=try&revision=9ccd03d89841ac8b0cbf1d8868ea2061cbbe85d0) for part 1.~~ Additionally, there was a small bug which caused `NotifySelectionListener()` to notify for `eNormal` selections even when triggered by highlight selections. This change reduced the `Highlight::Add()` call even further (~200ms now). ~~[Try run](https://treeherder.mozilla.org/jobs?repo=try&revision=4cc7319a0b7ae8ddc2d84bc0f27a0e67d569b20a) for part 2.~~ [Try run hopefully without build errors](https://treeherder.mozilla.org/jobs?repo=try&revision=825cc6483d0eb7e10e474f5967f1e468b74020d1).