unlazy
unlazy copied to clipboard
(draft) feat: use web workers for placeholder hash calculation
๐ Linked issue
โ Type of change
- [x] ๐ Documentation (updates to the documentation, readme or JSDoc annotations)
- [ ] ๐ Bug fix (a non-breaking change that fixes an issue)
- [x] ๐ Enhancement (improving an existing functionality like performance)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [x] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
๐ Checklist
- [ ] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
Deploy Preview for unlazy ready!
| Name | Link |
|---|---|
| Latest commit | 8d3207a5bb53473587703f99b5988cd1db3c12a6 |
| Latest deploy log | https://app.netlify.com/sites/unlazy/deploys/64e6ef6c93f341000822f377 |
| Deploy Preview | https://deploy-preview-25--unlazy.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Thanks for the effort. There are many moving parts. I'm not sure what implications the async API has yet, since every framework integration depends on a sync API. Thus, it is a breaking change. I will take a deep dive later.
Currently I'm working on the web worker support for unbuild, because since a library is shipped, we have to add a rollup web worker plugin to the unbuild configuration.
Regarding the breaking async changes: I think it should mostly be fine, but I'll have a closer look, when I have time to work on the pull request further. Thanks for your first feedback ๐
Some food for thought on this PR:
- Although I like the idea of using workers, a performance test would be great to get an idea of how big the gain really is.
- We need to make sure the web workers work in Node.js, browsers and worker environments. Unlazy is specifically written to provide SSR support out of the box, which we need to maintain.
- This is probably related to your unlazy web worker support implementation. Good luck with it!
- Please also update the framework integrations, as the async placeholder generation would also require async watchers.
The bottom line is: I'm OK with the current synchronous implementation. I can only provide limited resources on the worker technology shift. But I'm still open to that one! It just has to be implemented airtight to not break user land.
I had some fun implementing the rollup plugin for web workers today, but to no success.
Switching from unbuild to vite for building the core package would probably fix the issue,
since vite offers built in support for web workers.
I'm not a huge fan, but I think for the moment it's the only way, I'm getting the web worker support to work. Will have a look at it maybe tomorrow, to see what actual performance benefits the web worker approach brings to the table ๐ If the boost is high enough, we can look at some possible fixes for the issue.
This looks very promising and I appreciate the work being done on this ๐. Thank you.