heremaps / flexible-polyline

Flexible Polyline encoding: a lossy compressed representation of a list of coordinate pairs or triples
MIT License
91 stars 77 forks source link

Kotlin implementation of https://github.com/heremaps/flexible-polylin… #79

Open moo24 opened 4 months ago

moo24 commented 4 months ago

Kotlin implementation of Flexible Polyline encoding based on Java implementation. API wise, I implemented the Dart API as I prefer that one.

Note: There are currently still dependencies to java.util.concurrent.atomic which should be replaced with kotlin.native.concurrent or a project like https://github.com/Kotlin/kotlinx-atomicfu in case the code shall be used with a kotlin multiplatform project.

Tests are passing. Performance on JVM seems worse (about 4x) than pure Java implementation; so there is room for improvement. However, intention is to provide a kotlin implementation in case someone needs it (e.g. for Kotlin native projects).

cio commented 4 months ago

Hi,

Is there a specific reason why you used the AtomicX classes? An old version of the Java implementation had them and let's say just that I am glad that we got that part completely re-written.

moo24 commented 4 months ago

Thank you for the hint. I created the first implemenation some time ago, but never got to contribute it to this project. I now refactored it to also remove the atomic.* references. A nice side effect - the code performance improved.

moo24 commented 4 months ago

Fixed the missing commit sign-off.