Skip to content

Commit a760d9a

Browse files
kddnewtonbyroot
andcommitted
Make the JSON parse loop iterative
As opposed to a recursive loop. We do this by keeping a stack of frames (very similar to how the stack of values was already stored). Each frame represents the state of a container. Since there are only 2 in JSON, it doesn't have to get too complex. Each frame in the iterative parser now holds an enum describing its "phase", in order to support suspending parsing. For performance to be on par with the previous implementation, we directly jump to the proper handler in most cases. `JSON_ParserState.stack` was renamed into `.value_stack`, as with the introduction of the frames stack, the naming became confusing. Co-Authored-By: Jean Boussier <jean.boussier@gmail.com>
1 parent 52c9d9b commit a760d9a

1 file changed

Lines changed: 462 additions & 188 deletions

File tree

0 commit comments

Comments
 (0)