kungfoo / geohash-java

Implementation of GeoHashes in java. We try to be/stay compliant to the spec, as far as possible.
Other
985 stars 309 forks source link

Use array for decoding #51

Closed mauhiz closed 3 years ago

mauhiz commented 3 years ago

Observed that parsing is slower that it needs to be, due to the map lookups:

Screen Shot 2020-12-28 at 15 42 58

In this PR I replace double lookup (containsKey + get) with simple array access. I did not benchmark properly but simply ran testDecode 100x, several times Before: ~8s After: ~6s

kungfoo commented 3 years ago

I doubt this will make a huge difference, but I like it. Map lookups are also just array access, under the hood. But this is cool.