question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File size optimization

See original GitHub issue

Currently nsi-id-presets.min.json is about 8MB in size which is a lot. A possible way to solve this problem is to split it per country. There will be duplicated information across files, but it will load much faster for all users. A side effect would be that it will reduce loading times of the editors and speed up the validation speed of brands. Such change will require changes in the build process and changes to how iD and RapiD handle brands (which is why I’m tagging @tyrasd and @bhousel). Are you in support of such change and would it be too hard to implement? Also, are there any other data consumers that will be affected? If there are, it would be nice to leave both “systems” to coexist and add a folder in dist where the new per country method is used.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
westnordostcommented, Feb 14, 2022

I now implemented

  • the ability to load presets by country lazily on demand in osmfeatures v4.0
  • adapted the build script that fetches the NSI presets from this repository to also split up the presets by country. I also extended the script to expand the UN M49 codes to normal ISO-3166-1 alpha2 country codes, transform includes like “us-ny.geojson” to simply “us-ny” codes (ISO-3166-2) and throw away other “*.geojson”-includes plus those “radius around geoposition”-includes as it is not supported by osmfeatures library
  • The files then looks like this

Loading all the presets (normal presets + localization + international brand presets + presets of the country one is in) during startup now takes 0.6s compared to 2.7s before on my phone. So roughly 4 times faster now.

1reaction
westnordostcommented, Feb 27, 2022

From my end, no, because I already wrote the script to take apart the nsi.json myself. That script contains additional stuff - as outlined in my last message - that will probably not be done if the files were already separate this way in the dist folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TinyPNG – Compress WebP, PNG and JPEG images ...
TinyPNG uses smart lossy compression techniques to reduce the file size of your WEBP, JPEG and PNG files. By selectively decreasing the number...
Read more >
Free Image Optimizer - Compress and resize photos
Using this free online service, you can resize, compress and optimize your image files. Using the service is as easy as clicking of...
Read more >
Online Image Сompressor
Optimizilla is the ultimate image optimizer to compress your images in JPEG, GIF and PNG formats to the minimum possible size.
Read more >
How To Optimize Images for Web and Performance (2022)
One really handy feature is the ability to set the minimum file size for compression. For example, if you have images that are...
Read more >
Reduce the file size of a picture in Microsoft Office
You can reduce the file size and save disk space by compressing pictures in your document. The compression options reduce both the file...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found