brianmario/yajl-ruby

support Enumerator

Closed this issue · 2 comments

A streaming library should support Ruby's streaming data type. This will keep memory low and also allow streamed HTTP responses.

Enumerator has it's own set of issues, namely spinning up a new thread once #next is called. The lower level yajl API doesn't really lend itself to this as it just fires callbacks as it's parsing. Meaning I'd have to maintain an internal buffer and state to know where the caller left off. That would defeat the purpose of streaming (since I can't block yajl from firing callbacks in C during the parse).

do you mean spinning up a new fiber when #next is called? I don't think Enumerator uses any threads.