2 Commits

Author SHA1 Message Date
Wyatt Allen
0490413eb8 Applies optimizations to GR-DIFF-SELECTION
A major source of latency in creating comments in large diffs stems from
GR-DIFF-SELECTION applying selection-restricting classes to a parent of
the diff. When the diff contains a large number of lines (and thus a
large number of elements) applying a class forces a style recompute for
the substantial subtree.

This change optimizes this in two ways:

* **Initialize to the right side:** The selection-restricting class is
  initialized to the right side, before the diff is even completely
  built. This eliminates the need for a recomputation preceding the
  first comment add on the right side (the most-likely side to be
  interacted with).
* **Minimize the number of class modifications:** only add or remove
  classes when necessary. This eliminates recomputes for consecutive
  mousedown events that occur on the a common diff side.

On an i7 MBP, this eliminates ~120ms for the first comment on the right
and ~40ms for subsequent such comments.

Change-Id: Ibb8a7eca0398a5c7265dc1385967bce3dae5e5ef
2016-08-10 11:47:27 -07:00
Viktar Donich
e1341972d1 Move text selection out of gr-diff.
Change-Id: I0734653066a1bb78f95c141aa8202fad315b13c0
2016-06-10 12:18:25 -07:00