Faster JSON

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Faster JSON

#1 Post by xela » Wed Aug 06, 2014 2:46 am

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)?
Like what we're doing? Support us at:
Image

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Faster JSON

#2 Post by PyTom » Wed Aug 06, 2014 9:36 pm

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.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Human Bolt Diary
Regular
Posts: 109
Joined: Fri Oct 11, 2013 12:46 am
Contact:

Re: Faster JSON

#3 Post by Human Bolt Diary » Wed Aug 06, 2014 10:25 pm

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.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Faster JSON

#4 Post by xela » Wed Aug 06, 2014 10:55 pm

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).
Like what we're doing? Support us at:
Image

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Faster JSON

#5 Post by PyTom » Thu Aug 07, 2014 10:07 am

Python's module deos have C speedups. It didn't in 2006, but the current version does. (That's what _json.so is!)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Faster JSON

#6 Post by xela » Thu Aug 07, 2014 10:16 am

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.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: No registered users