Repository navigation
Better perfomance with different lexer parameters - #208
Conversation
|
Thanks for the contribution, it's quite an interesting idea! Looking at the man page of
Could you benchmark with only the |
|
Based on [1] and [2], I'd say the man page of [1] https://ocaml.org/manual/5.5/lexyacc.html Benchmarking only the To be more precise. In table mode, we can disable positions updating by providing our own implementation of |
|
That's a good point, I've sent a PR to the compiler to update the man page. So if I read Gabriel's message correctly with the improvements in 4.08+ there is no need for the lexing engine hack. Could you remove it and see if it changes the performance characteristics? I would say that anything older than 4.08 is probably not sufficiently relevant these days to keep the hack in. |
…gine, now unnecessary
Removed the overrride for |
|
Very good and yes, that makes sense. Can you add a changelog entry? Then it looks good to go from my side. |
df9e87c
into
ocaml-community:master
Use
-mlinocamllexand~with_positions:falsefor faster lexing.The tests all pass.
I've benchmarked
Yojson.Safe.from_string, for file sizes of 1 kB, 10 kB, .... Using OCaml 5.5, measured in an AMD EPYC 9755, I see the following improvemets:In an older Intel i5-8600, improvements are more modest, between 15% and 25% (smaller files always better).
See this gist for how to run the same benchmarks: https://gist.github.com/ferminr/54fb56b4d99be3cd21c5c0fc45c4cef4
Binary size of library
yojson.aincreases from 1.17 MB to 1.47 MB, due to the lexer generated with-ml.