ibmruntimes / yieldable-json

Asynchronous JSON parser and stringify APIs that make use of generator patterns
Other
145 stars 22 forks source link

Potential to block when parsing huge string with lots of escaped characters #18

Open toniuyt123 opened 5 years ago

toniuyt123 commented 5 years ago

The way string normalization is done is blocking and tough it would normally be fast, in case of an enormous string with many escaped characters the operation will be very slow and blocking. The easiest way to achieve this is by stringifying a json string and then parsing it back. I'd suggest making it into a generator function so that it can yield and also looking for a way of speeding it up.

gireeshpunathil commented 5 years ago

@toniuyt123 - thanks for raising this, and for the proposal! definitely looks promising; will make a try with that approach. Meanwhile, please feel free to contribute, if you are willing!