3 ms·
It's single threaded, but with async I/O. That means that any I/O doens't block the main thread, and other parts of JS can execute. This example provides lite
by Klathmon 9y ago
It's single threaded, but with async I/O.
That means that any I/O doens't block the main thread, and other parts of JS can execute.
This example provides literally no benefits, and actually is a performance hit from converting the data from JSON, then sending it back to the main thread (which itself copies the data in a method similar to converting back to JSON then back to an object again in the main thread).
- developit 9y agoIt's true, the example could be better. However - adding any form of data pruning to the example would immediately show the benefit. JSON parsing happens in the worker, and only a small subset of data is actually serialized and sent back to the main thread.
- Klathmon 9y agoYeah, that would be a great way of handling it. The other would be to parse out the data and insert it into the IndexedDB and then in the main thread only pull out what is needed (I had to do exactly that for a B2B app that was receiving hundreds of MB of data a while back)