JavadocMD / simplelatlng

A simple, lightweight library for common latitude and longitude calculation needs in Java.
89 stars 20 forks source link

Slow LatLng.hashCode() performance #9

Closed GoogleCodeExporter closed 2 years ago

GoogleCodeExporter commented 9 years ago
The LatLng.hashCode() use formatting, string concatenation and 
String.hashCode() to produce hash code for LatLng with good distribution.

However, this is slow and takes time even when there is no changes to the 
LatLng value.

A simple way to improve it is by caching the hash code instead of 
recalculation, similar to the way String.hashCode() works.

See this as a suggested solution: 
https://code.google.com/r/hagaishatz-fasthash/source/browse/src/main/java/com/ja
vadocmd/simplelatlng/LatLng.java

Thanks.

Original issue reported on code.google.com by hagai.sh...@gmail.com on 6 May 2014 at 3:48

GoogleCodeExporter commented 9 years ago

Original comment by TylerCo...@gmail.com on 24 May 2014 at 8:55