You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduce TextDiffer allocations, including LOH (#11983)
TextDiffer.ComputeDiff shows as 1.3% of allocations in the razor
speedometer scrolling and typing test. There are two issues:
1) The IntArray class was using too large a page size when used in
conjunction with System.Buffers.ArrayPool. It was indicating it wanted
an 80KB buffer, and ArrayPool allocates it's pool entries on powers of
2, so it was giving back an 128KB array, which goes to the LOH. The fix
is to request a 64 KB buffer.
2) The IntArrays were being constructed over unnecessarilly large
ranges. If we instead prime the pump by detemining an initial changed
extent, we can request significantly less allocated space during the
typing scenario (reduces the requested array size from the buffer size
to just the changed range, tyipcally only a couple characters)
Reducing the size of the vf/vr arrays did require a redirection to the
SourceEqual method in the derived classes, as they don't know of that
concept.

0 commit comments