Skip to content

Conversation

@1-navneet
Copy link
Contributor

This PR addresses the zoom and pan performance issue described in #11832.

Problem

Profiling during zoom/pan interactions showed significant time spent repeatedly:

  • Computing SVG tag class strings for entities whose tags were unchanged
  • Measuring SVG text widths during label redraws

These operations were executed on every redraw, even when the underlying data did not change.

Solution

This change reduces redundant work during redraws by:

  • Reusing cached tag class strings when entity tags are unchanged
  • Reusing a persistent SVG text measurer per font size to avoid repeated DOM create/remove cycles

Result

  • Reduced time spent in drawEditable during zoom/pan interactions
  • Hotspots such as tagClasses.getClassesString no longer dominate redraw time
  • No visual or behavioral changes observed

Testing

  • Tested locally using Chrome DevTools Performance profiling
  • Reproduced using the same location and zoom level as the issue report
    (zoom level 18 near 53.382847, -1.470167)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant