[Bug]: 1.19 - Grid rendering performance

Open
#6,171 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java

Research direction

Start by comparing square-grid rendering and map panning behavior between versions 1.18 and 1.19.0-alpha.1, then profile while dragging at zoom levels above and below 50% to locate the slowdown. Done when panning with a visible square grid is smooth at typical zoom levels; the issue names no source files or tests.

Written by the indexing model from the issue text.

Description

bug performance
Describe the Bug

I mainly use MT with square grids. On 1.18, I could smoothly interact with MT (e.g., by panning the map) while the grid is displayed. On 1.19, the map moves sluggishly when panned, making it difficult to look at.

If I zoom out to <50%, then performance is okay.

To Reproduce
  1. Open MT
  2. Make a map with a square grid type
  3. Show the grid.
  4. Drag to pan the map.
Expected Behaviour

The map should pan smoothly in response to user interaction.

Screenshots

No response

MapTool Info

1.19.0-alpha.1

Desktop

Linux Mint 22.3

Additional Context

For comparison, I did some timings on a blank map with only a solid background color and the grid being rendered at 100% zoom. On both versions, I hacked the timer thresholds to 0 so we can see everything, and grabbed a representative frame.

On 1.18.8:

Timer ZoneRenderer.renderZone (34 elements)
    0.       4 ms  <root>
    1.       4 ms  paintComponent
    2.       0 ms  paintComponent:allocateBuffer
    3.       0 ms  update
    4.       0 ms  setup
    5.       0 ms  calcs-1
    6.       0 ms  ZoneRenderer-getVisibleArea
    7.       0 ms  createTransformedArea
    8.       2 ms  board
    9.       0 ms  drawableBackground
   10.       0 ms  drawableObjects
   11.       0 ms  grid
   12.       0 ms  renderLights
   13.       0 ms  renderLumensOverlay
   14.       0 ms  renderAuras
   15.       0 ms  drawableTokens
   16.       0 ms  drawableGM
   17.       0 ms  unowned movement
   18.       0 ms  labels-1
   19.       0 ms  renderFog
   20.       0 ms  owned movement
   21.       0 ms  token name/labels
   22.       0 ms  renderVisionOverlay
   23.       0 ms  overlays
   24.       0 ms  overlays: PointerOverlay
   25.       0 ms  renderCoordinates
   26.       0 ms  lightSourceIconOverlay.paintOverlay
   27.       0 ms  RenderHelper-createContext
   28.       0 ms  RenderHelper-doRender
   29.       0 ms  RenderHelper-useAA
   30.       0 ms  RenderHelper-setTransform
   31.       0 ms  RenderHelper-render
   32.       0 ms  RenderHelper-disposeContext
   33.       2 ms  paintComponent:renderBuffer

And on 1.19.0-alpha.1

Timer ZoneRenderer.renderZone (34 elements)
    0.   20387 μs  <root>
    1.   20383 μs  paintComponent
    2.       2 μs  paintComponent:allocateBuffer
    3.      61 μs  update
    4.       4 μs  setup
    5.       2 μs  calcs-1
    6.       0 μs  ZoneRenderer-getVisibleArea
    7.       1 μs  createTransformedArea
    8.    2056 μs  board
    9.      10 μs  drawableBackground
   10.       0 μs  drawableObjects
   11.   16599 μs  grid
   12.      10 μs  LightsRenderer-renderLights
   13.       0 μs  LumensRenderer-renderLumensOverlay
   14.       4 μs  LightsRenderer-renderAuras
   15.       3 μs  drawableTokens
   16.       0 μs  drawableGM
   17.       4 μs  unowned movement
   18.      30 μs  labels-1
   19.       0 μs  FogRenderer-renderFog
   20.       0 μs  owned movement
   21.       1 μs  token name/labels
   22.       0 μs  VisionOverlayRenderer-renderVisionOverlay
   23.      15 μs  overlays
   24.       2 μs  overlays: PointerOverlay
   25.       0 μs  renderCoordinates
   26.       0 μs  lightSourceIconOverlay.paintOverlay
   27.       0 μs  DebugRenderer-createContext
   28.      20 μs  DebugRenderer-doRender
   29.       1 μs  DebugRenderer-useAA
   30.       4 μs  DebugRenderer-setTransform
   31.      14 μs  DebugRenderer-render
   32.       0 μs  DebugRenderer-disposeContext
   33.    1485 μs  paintComponent:renderBuffer
Dominant language
Java
Stars
927
Forks
286
Avg merge
3d 17h
Merged PRs (30d)
94

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RPTools/maptool

All issues in RPTools/maptool

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.