perf: add cached CRS variants and benchmarks - #2188
Conversation
|
Thanks for submitting this! It looks good so far, although we'll need to look into the API just a little more. Sorry it's taken so long to acknowledge! |
d10aa08 to
4fd8f05
Compare
|
@JaffaKetchup Thanks for the review. I’ve addressed your feedback and pushed an update. |
JaffaKetchup
left a comment
There was a problem hiding this comment.
Hey, sorry this has taken so long to get around to.
While it makes sense that there is a saving to be had here in theory, I can't seem to actually reproduce that saving practically.
I've copied the benchmark into a small Flutter app here that I've then built as a windows app in release mode, and run it. Here's the results after running it twice:
Results:
(duration: 0:00:01.877254, name: Concrete type: EPSG:3857.latLngToXY())
(duration: 0:00:01.842099, name: Concrete type (cached): EPSG:3857.latLngToXY())
(duration: 0:00:01.853412, name: Concrete type: EPSG:3857.latLngToOffset())
(duration: 0:00:02.739893, name: Concrete type (cached): EPSG:3857.latLngToOffset())
(duration: 0:00:03.944211, name: EPSG:3857.latLngToXY())
(duration: 0:00:04.187178, name: EPSG:3857.latlngToPoint())
(duration: 0:00:03.631236, name: EPSG:3857.pointToLatLng())
(duration: 0:00:03.960620, name: EPSG:3857 (cached).latLngToXY())
(duration: 0:00:12.264181, name: EPSG:3857 (cached).latlngToPoint())
(duration: 0:00:06.545066, name: EPSG:3857 (cached).pointToLatLng())
(duration: 0:00:01.981328, name: EPSG:4326.latLngToXY())
(duration: 0:00:02.333006, name: EPSG:4326.latlngToPoint())
(duration: 0:00:01.039483, name: EPSG:4326.pointToLatLng())
(duration: 0:00:01.794606, name: EPSG:4326 (cached).latLngToXY())
(duration: 0:00:03.126626, name: EPSG:4326 (cached).latlngToPoint())
(duration: 0:00:01.443465, name: EPSG:4326 (cached).pointToLatLng())
Results:
(duration: 0:00:01.982466, name: Concrete type: EPSG:3857.latLngToXY())
(duration: 0:00:01.908172, name: Concrete type (cached): EPSG:3857.latLngToXY())
(duration: 0:00:01.873510, name: Concrete type: EPSG:3857.latLngToOffset())
(duration: 0:00:02.677458, name: Concrete type (cached): EPSG:3857.latLngToOffset())
(duration: 0:00:04.010353, name: EPSG:3857.latLngToXY())
(duration: 0:00:04.265552, name: EPSG:3857.latlngToPoint())
(duration: 0:00:03.749994, name: EPSG:3857.pointToLatLng())
(duration: 0:00:04.039208, name: EPSG:3857 (cached).latLngToXY())
(duration: 0:00:04.681983, name: EPSG:3857 (cached).latlngToPoint())
(duration: 0:00:03.934013, name: EPSG:3857 (cached).pointToLatLng())
(duration: 0:00:02.063724, name: EPSG:4326.latLngToXY())
(duration: 0:00:02.350731, name: EPSG:4326.latlngToPoint())
(duration: 0:00:01.015305, name: EPSG:4326.pointToLatLng())
(duration: 0:00:01.944075, name: EPSG:4326 (cached).latLngToXY())
(duration: 0:00:02.937107, name: EPSG:4326 (cached).latlngToPoint())
(duration: 0:00:01.399678, name: EPSG:4326 (cached).pointToLatLng())
As you can see, the cached versions are usually just as good or worse than the non-cached versions. I'm not fully convinced where the savings from #2183 (comment) were found?
I wonder if this is a case where the theoretical savings are much larger than any real savings?
fixed #2183