[openstreetmap/openstreetmap-website] Avoid using partial rendering in /map.json (PR #4141)
Andy Allan
notifications at github.com
Wed Aug 16 12:22:52 UTC 2023
Thanks @stillhart for the PR. As @tomhughes says, this code isn't used in production on openstreetmap.org. However, I'm happy to receive pull requests to improve performance. Firstly, because these techniques can also apply to other parts of the codebase, and secondly, to help when developers are testing things locally (e.g. working on the data overlay UI, which uses the map call). So while there's limited benefits, there are still benefits to be had.
For this PR, it's effectively inlining the code from the three element partials. This means that it's duplicating code - the original `app/views/api/nodes/_node.json.jbuilder`partials still exists. Is there some way that we can avoid this duplication, so that there is only one part of code that generates the json for a way, instead of the same code appearing multiple times?
Secondly, I would like to keep the approach the same for JSON and XML. So if we do something for the json (e.g. inlining) then we should do the same for the XML, since (presumably?) the same problem applies there too.
You mention N+1 queries, and those are definitely worth solving, that might be worth doing in a separate PR :+1:
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4141#issuecomment-1680505635
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4141/c1680505635 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230816/25645cbf/attachment-0001.htm>
More information about the rails-dev
mailing list