PMJSON
PMJSON copied to clipboard
Make decoder non-recursive
A recursive decoder means we can't decode arbitrarily-deep JSON hierarchies. If we switch to storing our decoding state in an array instead of on the stack, we can remove this limitation.
Note: Test performance to make sure that using an array doesn't noticeably slow down the decoder.
I'm not sure this really matters. The current default cap is a depth of 10,000, and it seems rather unlikely to have real-world JSON that even hits this cap, let alone needs more. The motivation for this issue is largely the fact that I'd like to not need a cap at all, but I suspect a non-recursive decoder would be sufficiently complicated so as not to be worth the effort.