misha-plus / simplelatlng

Automatically exported from code.google.com/p/simplelatlng
0 stars 0 forks source link

Slow LatLng.hashCode() performance #9

Open GoogleCodeExporter opened 9 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