Skip to content

editorService & modelService refactor and optimizations

Administrator requested to merge refactor-editors-models into master

Created by: lguychard

Still a fair bit of cleanup to do here, but this introduces some significant improvements towards https://github.com/sourcegraph/sourcegraph/issues/5172.

Notable changes:

  1. Refactor editorService, modelService to be backed by Maps, rather than immutable arrays.
  2. Emit incremental updates of added/updated/deleted editors and models, rather than a new array of all editors/models on every emission. This dramatically reduces GC pressure, and improves efficiency of adding/updating/deleting models and editors.
  3. Introduces editorService.activeEditorUpdates, to avoid needless iteration over all editors when computing context keys.
  4. Introduces editorService.activeLanguages (still very rough, may move to modelService) to avoid needless iteration over all editors when computing active extensions.

All tests passed before I started working on 3. and 4.

On the 999-file PR (https://github.com/sourcegraph/sourcegraph/pull/5157/files#diff-1de4be34265b5e830d0e2a2fea7f386bR866), I was able to reliably load up to 400 code views, including blob fetching, in <90seconds. On the same PR, an extension built from master stalls after 270 code views loaded in ~5 minutes.

Merge request reports

Loading