Skip to content

Performance issue when using ObservableMemoryLayer #3270

@nabeelio

Description

@nabeelio

Mapsui Version
5.0.2

Mapsui Platform
WPF

Device
Windows 11

Describe the bug

So I just updated the MapsUI library from 5.0.0-beta9 to the latest 5.0.2. And there's a performance issue now with using ObservableMemoryLayer that wasn't in the beta. The rendering gets slower and slower.

Basically I am doing flight tracking and adding the points to an observable line feature. It looks like this:

GeometryFeature? _playerFlownLineFeature;
ObservableCollection<MPoint> _playerFlownVertices;

_playerFlownLineLayer = new ObservableMemoryLayer(GetFeature) {
    Name = "playerPositionLayer",
    Style = FlightPathStyle,
    ObservableCollection = _playerFlownVertices,
};

IFeature? GetFeature(MPoint f)
{
    _playerFlownLineFeature.Geometry = MapUtils.SplitLineForIdl(_playerFlownVertices.ToArray());

    return _playerFlownLineFeature;
}

But now as more features vertices get added, it starts off from around 60+ FPS and starts crawling. Now it's down to 4FPS, the count being 5200. I'm not sure if I'm doing this the right way. But it ends up locking up the entire app.

Image Image

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