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?
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? ;-)
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
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?
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? ;-)
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