Is there a way to JSON.parse without blocking the main thread?

Viewed 100

Is there an async way to JSON.parse without blocking the main thread? I am receiving chunks of compressed JSON in an array that are really large, and currently it is blocking the main thread for ~5-6 seconds when it's time to parse it after decoding and decompressing (loading spinner is frozen).

I've tried web workers but the spinner is not continuous, so it freezes every half a second or so, which I assume is because it's needing to serialize and deserialize when sending the parsed data back to main thread which kind of defeats the purpose.

Any tips to approach this would be appreciated

0 Answers
Related