Page 1 of 1

Faster JSON

Posted: Wed Aug 06, 2014 2:46 am
by xela
Is there any chance that a faster json parser is added to Ren'Py? Preferably one partly written in C (simplejson is almost identical to the original python one)?

Re: Faster JSON

Posted: Wed Aug 06, 2014 9:36 pm
by PyTom
We're currently using the Python json module, which is based on simplejson. As far as I know, this is partially written in C - we ship _json.so on Linux and Mac, and the _json module built-in to python27.dll on windows.

Re: Faster JSON

Posted: Wed Aug 06, 2014 10:25 pm
by Human Bolt Diary
My first thought was "How slow can the default module be?" Turns out, pretty slow.

http://unethicalblogger.com/2009/12/04/ ... -town.html
http://brett.is/writing/about/fastest-p ... n-library/
https://pypi.python.org/pypi/ujson

Does Ren'Py use JSON enough to warrant another external dependency? Seems like using something on a per-project basis would be fairly painless.

Re: Faster JSON

Posted: Wed Aug 06, 2014 10:55 pm
by xela
I know... python own module doesn't have C speedups... I don't think Ren'Py itself warrants an update but some games <coughs, mine, coughs> just might :)

In any case, if it's not desirable, I'll look for other options (there always are). I couldn't figure out how to integrate C boosted module without recompiling Ren'Py (if at all possible obviously).

Re: Faster JSON

Posted: Thu Aug 07, 2014 10:07 am
by PyTom
Python's module deos have C speedups. It didn't in 2006, but the current version does. (That's what _json.so is!)

Re: Faster JSON

Posted: Thu Aug 07, 2014 10:16 am
by xela
I wasn't aware of that... Thank you for the info, in this case it cannot be improved significantly with simplejson :( Guess it's analyzing filename strings or cPickle for me then, I went with JSON for my game but as the amount of info got bigger and bigger, loading times became almost unacceptable. Both filenames and especially cPickle are a lot faster.