-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load the route snapper in a web worker #23
Comments
https://stackoverflow.com/questions/44118600/web-workers-how-to-import-modules/45578811#45578811 |
https://rustwasm.github.io/wasm-bindgen/examples/wasm-in-web-worker.html |
…e hang the browser for a full 2s. #23
... doesn't work, we can't ship a WASM thing across the web worker channels
Argh, this is really annoying. I can do the expensive step of deserializing in a web worker, but the resulting JS/WASM magic blob can't be passed back to the main thread due to https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#transferring_data_to_and_from_workers_further_details |
The only way I can think to make this work is to totally keep the route snapper in the web worker. Only communicate with it asynchronously by sending messages and awaiting responses. That's a much bigger change, going to shelve this for now |
Seems to work fine for me on Firefox in any case. |
https://acteng.github.io/atip/scheme.html?authority=Greater%20London#9.86/51.4737/-0.1634 Once the progress bar reaches the end (download is done), for me there's a noticeable ~13 second lag when you can't drag the map. We're deserializing and blocking the main thread. That's the problem I want to solve here |
Sounds like a bonus feature, still faster than the PCT and all client side so not too shabby for the largest region we have. |
Many perf improvements to the snap tool needed, but one short-term might be to do the initial load in a web worker. Otherwise the map loading will hang
The text was updated successfully, but these errors were encountered: