Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

[Enhancement] Performance-Friendly IMathTransform Alternative #32

Open
@airbreather

Description

The GeoAPI.CoordinateSystems.Transformations.IMathTransform API is sub-par. Unless the implementer and consumer mutually agree on a protocol that would allow outputs to be pooled (which is stricter than what GeoAPI demands), it pretty much forces all implementations to allocate a whole new object on the managed heap for every call to hold the return value.

This is pretty bad, and TransformList methods don't help this at all... in fact, they can make it worse, because in exchange for reducing virtual calls compared to the alternatives, they force all the inputs and outputs to be allocated at once, which (beyond a certain list size) will guarantee that they get tenured.

For a while, we were using our own Geotools.NET at work, and we solved this with just a void Transform(ref double x, ref double y). PackedDoubleCoordinateSequence.GetRawCoordinates() gives us what we need to use that method to project / unproject without any temporary allocations.

Obviously, it's a lot more complicated to do this in GeoAPI / ProjNet4GeoAPI, since there are external consumers. Any thoughts about how we could make this better?

Metadata

Assignees

No one assigned

    Labels

    breaking changeDoing this would break either source or binary compatibility with existing versions.enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions