Hacker News new | ask | show | jobs
by byroot 530 days ago
Yes that's what I meant. The benchmark suite I took from rapidjson was benchmarking against:

    Oj::Parser.usual.parse(string)
That is what isn't thread safe. And yes you can implement a parser pool, or simply so something like:

   parser = (Thread.current[:my_parser] ||= Oj::Parser.new(:usual))
But that didn't really feel right for a benchmark suite, because of the many different ways you could implement that in a real world app. So it's unclear what the real world overhead would be to make this API usable in a given application.

> is that it stores the parser state.

And also a bunch of parsing caches, which makes it perform very well when parsing the same document over and over, or documents with a similar structure, but not as well when parsing many different documents. But I'll touch on that in a future post when I start talking about the parsing side.