Reduce Postgis shared library size to <8mb#62
Reduce Postgis shared library size to <8mb#62larsmennen wants to merge 1 commit intoelectric-sql:tdrz/backend-trypostgis-2from
Conversation
|
@larsmennen Cool stuff. Not to take anything away from your efforts, but I was hoping we could get the preload plugins working instead: " Should have mentioned it in that PR. |
Did you also try Postgis' own test suite? There are some comments in that PR documenting how to do it. |
|
@tdrz makes sense -- I'll try out getting the preloading working in the next couple days and get a PR up. Do you want to keep the size optimisations in then as well, or take those out? |
@larsmennen Please leave this PR as it is, we just might use it if we can't get the preload plugins to work for the >8MB |
This aims to resolve the outstanding issue ( electric-sql/pglite#807 (comment) ) on electric-sql/pglite#807 that the Postgis library is over 8mb and Chrome has a hard 8mb limit for WASM modules.
This is achieved by:
--whole-archive(saves ~250k bytes)-fltofor link-time optimisation (saves ~11k bytes)-Oz(saves ~45k bytes)wasm-optstep (saves ~30k bytes)Brings it down in total to 8,370,885 bytes (8,388,608 limit).
This works locally for me in Chrome and seems to pass the test suite used on the above PR.
Performance-wise, the effects of
-Ozseem neglible. I have not ran a extensive benchmark, but on a table with 20k points and 200 regions (w/ index) running a couple queries likeST_DWithin,ST_Intersects, etc. 5 times on the optimized and non-optimized versions, the differences are within 1-2% either direction.