Repository navigation
The places list and the trip bundle spend about 90% of their time in the country lookup #3051
Replies: 1 comment
|
Thanks @jjahn-source, this is in v5.1.4: country lookups are now cached, so the places list and the trip bundle no longer redo them on every read. Thanks for the detailed measurements! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
GET /api/trips/:id/placesandGET /api/trips/:id/bundleresolve the country of every place that has no cached region, on every read (resolveCountryCodeSyncinplaces.service.ts). A CPU profile of a production build of 5.1.3 putsgetCountryFromCoordsandpointInPackedRingat about 90% of both routes: the lookup ray-casts every polygon of each candidate country, which is thousands of rings for a country that is mostly islands, and it does so again for the same coordinates on the next request.Two changes in
server/src/utils/country-borders.ts, neither of which changes an answer:Measured with a 360-place trip:
GET placesGET bundleThe trip is synthetic and about half of its places sit at sea, which is the slow case for the lookup. ATLAS-SVC-051 and ATLAS-SVC-055 already compare every country against the reference lookup and pass unchanged; six new cases cover the box check and the remembered answers.
Branch: https://github.com/jjahn-source/TREK/tree/perf/country-lookup-part-boxes
A PR is open alongside this: #3054. It was not pitched in
#github-prfirst, so close it if you would rather not take it.All reactions