[erlang-questions] fast JSON parser in C
Jonathan Gray
jlist@REDACTED
Wed Jul 23 17:31:57 CEST 2008
Chris,
Considering your primary goal is speed, you definitely don't want to use my
implementation.
I use an intermediate translation into a custom typed JSON tree. It's a
poor approach when you need it to be as fast as possible. It's done this
way for simplicity reasons as the JSON -> tree (and vice versa) already
existed when we wanted to then go to Erlang/ETERM. If a direct parser
existed I'd certainly use it.
I'm still exploring the issues with segfaulting during decoding. It's been
suggested to me to use ei rather than erl_interface, but it's quite a bit
more involved. An ideal JSON -> Erl parser would certainly be using ei
directly, so I'd dig around there for how you can build/decode Erlang from
within C.
http://www.erlang.org/doc/man/ei.html
Jonathan
-----Original Message-----
From: erlang-questions-bounces@REDACTED
[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Chris Anderson
Sent: Tuesday, July 22, 2008 10:19 PM
To: Jonathan Gray
Cc: erlang-questions@REDACTED
Subject: Re: [erlang-questions] fast JSON parser in C
On Tue, Jul 22, 2008 at 8:09 PM, Jonathan Gray <jlist@REDACTED> wrote:
> Chris,
>
> I'm currently using something just as you are describing. I have
> erl_to_json() and json_to_erl() functions in C which convert ETERM -> JSON
> and JSON -> ETERM. Both are recursive C functions which make use of
> erl_eterm from erl_interface.
Awesome to hear that you are building this already. Are you interested
in open sourcing it? My goal is to build a faster JSON parser for
CouchDB. I don't mind doing the work, but if you already have
something happening, why duplicate work?
Thanks for the technical feedback. I'll definitely take a look at the
marshaling stuff, but I'd rather look at your json stuff. :)
Chris
--
Chris Anderson
http://jchris.mfdz.com
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list