GraphiteEditor / Graphite

2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow.
https://graphite.rs
Apache License 2.0
7.76k stars 408 forks source link

Caching the WASM using service workers #1733

Closed Waishnav closed 5 months ago

Waishnav commented 5 months ago

During the first load for the Graphite, in the waterfall we can see the wasm file being requested if we refresh the tab, currently we relied on browsers capability to cache the requested assets. This can be improved by intercepting the request using service worker and serving the cached response if cache available.

This can improved the performance if graphite is being daily drivers for our users.

Screenshot_20240418_011250 In the above ss, it can be seen for wasm file it took 20 seconds also 2.3 MB of server bandwidth, we can save bandwidth throwing introduction of caching since it can be consider as static asset/file for each version in prod.

0HyperCube commented 5 months ago

Thanks for the feedback @Waishnav. However all modern browsers will cache the wasm file and merely verify that it has not changed in subsequent page loads (unless the browser has been configured to avoid caching). This means that there is no advantage of using a service worker. Unfortunately it appears that you have <1 Mbit/s which probably won't give great loading performance for a large web application. Given that caching is already implemented I will close this issue, but thanks again for reporting.