[openstreetmap/openstreetmap-website] Repeated XML parsing or storing points in memory in gpx.rb? (#2133)

Andy Allan notifications at github.com
Wed Feb 6 10:16:38 UTC 2019


When working on the lib/gpx.rb code I noticed that it repeatedly parses the XML file. This is because `gpx.points` is called from other methods, which rewinds the file pointer and parses the file all over again.

The advantage here is that we don't store the full list of parsed points in RAM, since they are each yielded and then discarded. But the disadvantage is that we parse the file to create the tracepoints for saving, then we parse it again to make the icon, then we parse it again to make the picture.

I don't have a feel for which approach (parse once vs parse many times) would be preferred so I'm seeking other input.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2133
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190206/85a01146/attachment-0001.html>


More information about the rails-dev mailing list