• Login or register

discuss.effbot.org

  • Popular
  • Recent
  • More Top-Down Parsing: JSON (effbot.org)
    1 point by effbot 1 year ago
    • 3 comments
  • 1 point by hevyelyhha 1 year ago 2 children

    I recently wrote a JSON parser in Java, because I wanted some extra features (blob values, optional string quotes and type specifiers for numbers). It can parse about 100MB/s which is 100 times faster than your measurement.

    You mean 10k as in 10 kilobytes of characters in a JSON string?

    • link
    • reply
    • 1 point by effbot 1 year ago 1 child

      CPython is an interpreted language with very little support for character handling (Python doesn't even have a character type), so 100x sounds reasonable. There's a C implementation for Python called python-cjson that claims to be 100-250x faster than existing JSON implementations. And the machine I used for the tests isn't very fast either...

      But as I mention at the bottom of the page, I'm interested in faster ways to do certain things in pure Python, not about breaking any absolute speed records. For this task, a stock CPython interpreter's not the optimal tool (I'd use C/C++ if performance was critical, other might try tools like psyco or pyrex).

      (on the other hand, am I wrong if I guess that you spent a bit more than an hour on your implementation, including testing and benchmarking? ;-)

      • link
      • reply
      • 1 point by kib2 1 year ago 0 children

        There was a very interesting post today here about scripting languages and speed: http://steve-yegge.blogspot.com/2008/05/dynamic-languages-strike-back.html

        • link
        • reply
  • Widget
  • Recent Comments
  • Leaders
Powered by