I've written a simple ASCII-only JSON parser in C++, rust, ocaml and standardml.
https://github.com/serpent7776/json-parse
Here's some quick stats:
Non-empty lines of code (including tests), time parsing a single ~90MB JSON, time parsing 13 JSON files of varying sizes, peak heap usage, total bytes allocated.
Note that the code wasn't written with performance in mind.
c++ | rust | ocaml | sml | |
---|---|---|---|---|
lines | 902 | 604 | 546 | 528 |
time parsing 1 json [s] | 1.476 | 0.683 | 1.637 | 2.300 |
time parsing all jsons [s] | 5.560 | 2.735 | 6.326 | 7.716 |
peak heap [MB] | 589.4 | 388.2 | 317.6 | N/A |
total allocated [B] | 1,074,494,993 | 598,650,503 | 335,248,296 | N/A |