worktank
objectbuffer
worktank | objectbuffer | |
---|---|---|
1 | 4 | |
34 | 161 | |
- | - | |
6.6 | 2.9 | |
29 days ago | 6 days ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
worktank
-
Web Crypto API
Workers are awesome but you are right, working with them can be painful without the right tooling.
Personally I've written my own libraries for abstracting all this away and I've having a blast working with workers now, maybe check them out:
- WorkTank [1]: This abstracts away the difference between browser workers and Node worker threads, it makes it easy to make worker pools, and it can transfer simple functions to a worker at runtime too.
- WorkTank loader: This abstracts away loading asynchronous function from a worker basically, you just add ".worker" to your file name and that file and all its dependencies are transparently replaced moved to a worker, all the rest of the app (TS types for example) doesn't even notice anything happened, it just works.
You might want to check out the more popular "comlink" library too, although it didn't work for me for whatever reason and it doesn't support worker pools I believe.
[1]: https://github.com/fabiospampinato/worktank
[2]: https://github.com/fabiospampinato/worktank-loader
objectbuffer
-
JavaScript APIs You Don’t Know About
is a great example, which I also tried to (poorly) reimplement myself.
It creates a new data structures that behave as an object for the user but is backed by SharedArrayBuffer in order to support parallel computation over it.
- [0]: https://github.com/Bnaya/objectbuffer
- Web Crypto API
-
isoworker - universal multithreading with main-thread dependencies, 6kB
There is a lot of complexity involved in representing arbitrary javascript objects inside an ArrayBuffer whilst making them thread-safe. I'd first point to a library like objectbuffer. There's also more fixed struct-like options such as Google's FlatBuffers or buffer-backed-object.
What are some alternatives?
wasm-futures-executor - Executor for asynchronous task based on wasm web workers.
proposal-atomics-wait-async - "asynchronous atomic wait" for ECMAScript
worktank-loader - WebPack plugin for WorkTank which enables you to execute whole files in a worker pool, transparently.
d2-checklist - Source for www.d2checklist.com, written in Angular and using the Bungie API
main-thread-scheduling - Fast and consistently responsive apps using a single function call
comlink - Comlink makes WebWorkers enjoyable.