[erlang-questions] fast JSON parser in C

Bob Ippolito bob@REDACTED
Fri Jul 25 00:56:24 CEST 2008


On Thu, Jul 24, 2008 at 2:53 PM, Chris Anderson <jchris@REDACTED> wrote:
> On Thu, Jul 24, 2008 at 4:43 PM, Bob Ippolito <bob@REDACTED> wrote:
>> There are pretty decent pure Erlang JSON libraries available. They're
>> pretty fast, relatively speaking, and they certainly don't crash the
>> Erlang interpreter ;) I would worry about C when you actually need to.
>
> I researched some into the C way of doing things, and wasn't sure how
> much overhead the ei communication would consume. Currently I'm
> working on a leex/yecc parser for JSON. The output format is quite
> flexible, so for now I'm just building it to pass the CouchDB cjson
> test_suite. Once it is working, it should be trivial to alter the
> format to fit an agreed-upon convention.
>
> I'll probably finish in the next day or two, and then I'll have an
> idea of whether using leex/yecc to generate Erlang provides a big
> speed boost. If it doesn't, at least I had fun!
>
> Joe's BIF idea does seem like the long-term solution.

I'd be curious to know if leex/yecc can do any better than mochijson2
(which is written by hand), especially considering that it uses
binaries instead of strings.

http://code.google.com/p/mochiweb/source/browse/trunk/src/mochijson2.erl

-bob



More information about the erlang-questions mailing list