DEV Community

loading...

Discussion on: js-coroutines gives your code: data indexing and lookup functionality, in idle time

Collapse
siimsoni profile image
Kristjan Siimson

This is really situational, because JSON.parse is really fast. With small workloads you will measure it in tens of microseconds. But it does block the event loop.

Collapse
miketalbot profile image
Mike Talbot Author

Agreed, parse is a lot faster than storage, but definitely can take more than 16.7ms with significant packets. You'd be trading performance for a smooth out, sometimes worth it with large packets. Should only be used if there is a glitch present I'd say.

Thread Thread
siimsoni profile image
Kristjan Siimson

If it was an option, I'd also consider using ndjson to split up the JSON objects into manageable chunks to get the best of both worlds.

Forem Open with the Forem app