Skip to content

Performance issue when pointer move #3290

@DmitryEvstakhov

Description

@DmitryEvstakhov

Mapsui Version
5.1.0-beta.1

Mapsui Platform
Avalonia

Device
Windows 11

We have a WPF project using Mapsui v4 that is being migrated to Avalonia using Mapsui v5.
We sometimes need to display several thousand objects (lines and polygons) on the map. The initial loading and rendering of objects is a bit slow, but that’s a minor issue.

The main problem occurs after all objects are fully rendered: when moving the mouse pointer over the map, there’s a constant call to GetFeatures, followed by re-rendering, which significantly slows down the entire application’s UI. No additional data is being loaded at this time, yet the UI still lags heavily.

Image

We have several tool panels — some are positioned over the map (e.g., Panel_1 from the image), others are placed beside it (Panel_2).
When moving the mouse over Panel_1, the slowdown still occurs, but moving the cursor over Panel 2 does not cause lag. If there are ComboBoxes on the panels, attempting to select an item causes a delay — even when interacting with controls on Panel 2 (during which GetFeatures is still being called).

I understand that displaying a large number of objects affects performance. But it seems to me that once we’ve rendered something on the map and are neither dragging the map itself nor loading new data, simply moving the mouse pointer or selecting an item in a ComboBox (or any other control) should not cause lag.

A minimal example can be found at https://github.com/DmitryEvstakhov/MapsuiPerformanceTest
In the example, a specified number of lines with varying numbers of random points are rendered on the map. It looks messy, but provides a good performance load. When the number of lines exceeds 1000, the difference in tooltip display speed between Panel 1 and Panel 2 becomes clearly noticeable. A significant delay is also clearly visible when opening the ComboBox.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions