-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fast JSON library #5
Comments
I found one (maybe only one) discrepancy. Empty strings encode as |
Here's a nasty bug: This fails to parse: {"foo":-1,"bar":-2} This is OK: {"foo": -1,"bar": -2} It's confusing negative numbers with Prolog's |
The library here:
Is not so slow anymore. Maybe Scryer Prolog improved or I did also some trealla testing, with the same library I guess Not as fast as SWI-Prolog, but somehow, not as drastic the issue is also settled for Trealla Prolog? |
Current JSON library (borrowed from Scryer) is nice but slow (mthom/scryer-prolog#1566).
I had the potentially terrible idea of using regular Prolog terms to represent JSON. This seems to work as long as we tweak ASCII control characters to print with
\u0000
escapes instead of\x0\
escapes.Of course it is very bad at validating JSON as it accepts input like
'{}'(':'([f,o,o], "bar"))
as{"foo":"bar"}
.There are probably more issues I haven't caught yet.
It uses the same representation for JSON values as the real JSON lib (e.g.
pairs([string("foo")-string("bar")])
) so it should be possible to swap this out for a proper lib when it is optimized.The text was updated successfully, but these errors were encountered: