4 ms·
In my experience the output is always a heterogenous tree of nodes, even if sufficient performance is required. Which is not great since that's quite literally
by alexvitkov 3y ago
In my experience the output is always a heterogenous tree of nodes, even if sufficient performance is required.
Which is not great since that's quite literally the worst possible data structure imaginable for modern CPUs, but I'm not aware of any other sane way to represent the common outputs of a parser - ASTs, GUI layout trees.
- viraptor 3y agohttps://www.cs.cornell.edu/~asampson/blog/flattening.html https://www.cs.cornell.edu/~asampson/blog/flattening.html Flattened AST. Not conceptually different, but a much better performance of implementation.
- cryptonector 3y agoParsers like simdjson output a sequence of tuples, not trees. You can do a lot with that even if you need a tree in the end because you can filter the stream first, thus using very little memory until you get to the part you're interested in, which you then hydrate by constructing the equivalent tree using just that part of the stream.