Browser extension feels slower recently
- Truncate descriptions
Created by: felixfbecker
The browser extension feels like it is slowing down GitHub recently.
Could this be because of Quinn's recent refactor to Model?
For example, take a look at this profile from switching two PR tabs:
A lot of time is spend in removeModel()
removing all the text documents from the code views.
Models are stored in an array and every removeModel()
removes one model with array.filter()
, meaning we are iterating roughly n^2 times: https://sourcegraph.com/github.com/sourcegraph/sourcegraph@browser-api/-/blob/shared/src/api/client/services/modelService.ts#L83:28
I think it should use a Map by URI instead.
We also should probably use asyncScheduler
instead of animationFrameScheduler
to give the event loop time to process other macrotasks inbetween.

