[erlang-questions] fast JSON parser in C

Bob Ippolito bob@REDACTED
Thu Jul 24 22:43:22 CEST 2008


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.

2008/7/24 Rick R <rick.richardson@REDACTED>:
> I second this. I have not yet gotten to the point in my project where I need
> this. But it is certainly a need looming out there on the horizon. With
> Yaws/Erlyweb/MochiWeb/etc becoming more prevalent and important. I could see
> this being a huge win for ajax/comet libraries.
>
> On Thu, Jul 24, 2008 at 1:19 PM, Jonathan Gray <jlist@REDACTED> wrote:
>>
>> Joe,
>>
>> It would certainly ease our integration.  JSON is certainly becoming
>> ubiquitous and tighter integration with Erlang would be very useful.
>>
>> One note, in my current implementation and in general, there's no real
>> direct mapping for JSON objects/dictionaries.  While Erlang does have
>> dicts,
>> we were never able to "create" them using erl_interface/ei, though I'm
>> sure
>> it's possible by dissecting the dict representation.  I use a {obj,
>> [{},{}]}
>> type representation now to handle JSON objects in Erlang.  Any thoughts?
>>
>> +1 on new JSON BIFs :)  Willing to help in any way I can.
>>
>> Jonathan Gray
>>
>> -----Original Message-----
>> From: erlang-questions-bounces@REDACTED
>> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Joe Armstrong
>> Sent: Thursday, July 24, 2008 3:49 AM
>> To: Martin Carlson
>> Cc: erlang-questions@REDACTED
>> Subject: Re: [erlang-questions] fast JSON parser in C
>>
>> Since JSON seem to be ubiquitous is seems to me that there would be
>> a strong case for a couple of new BIFs,  term_to_json and json_to_term.
>> these would work like binary_to_term and term_to_binary the difference
>> being that
>> instead of converting to a binary containing the external term format,
>> we convert
>> to a binary containing a JSON encoded string.
>>
>> I imaging that modeling this code on the existing term_to_binary and
>> binary_to_term
>> code would not be impossibly difficult (you have to make it reentrant
>> and not to
>> not hog the CPU for too long ... and so on ...)
>>
>> And yes - it is pretty horrid increasing the number of BIFs but this
>> might just be
>> a useful addition.
>>
>> This would ease seamless integration with a lot of external programs :-)
>>
>> /Joe Armstrong
>>
>> On Thu, Jul 24, 2008 at 11:02 AM, Martin Carlson
>> <martin@REDACTED> wrote:
>> > You might want to go with the ei interface rather than the erl_interface
>> > since it is not as clumsy to use. Further, you might want to have a look
>> > at the ejabberd expat driver and just replace the expat stuff with your
>> > json SAX events.
>> >
>> >  -Martin
>> >
>> > Chris Anderson wrote:
>> >> On Wed, Jul 23, 2008 at 1:49 PM, Jonathan Gray <jlist@REDACTED>
>> >> wrote:
>> >>> However when I get a big chunk (around 80-120K) directly from Erlang
>> >>> as
>> >>> binary (using term_to_binary in erlang), I'm unable to decode it using
>> >>> erl_interface erl_decode, though it can be decoded fine from within
>> Erlang.
>> >>
>> >> Good to know - CouchDB's Erlang -> JSON encoding is fast enough to not
>> >> need help from C. I'm just working on making the JSON -> Erlang fast
>> >> enough, so as long as I can get string buffers over to C in the first
>> >> place, it sounds like you're not having a problem moving data from C
>> >> back to Erlang.
>> >>
>> >> Time to buckle down and code!
>> >>
>> >
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://www.erlang.org/mailman/listinfo/erlang-questions
>> >
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
>
> --
> An idea that is not dangerous is unworthy of being called an idea at all. --
> Oscar Wilde
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list