You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original JSON (Python 3.6) performance differs completely in performance for unicode strings that contain non-us-ascii characters. So, could you provide performance comparison for case ensure_ascii=False and national symbols in source strings? I mean dumps() / dump(). This is important since size of JSON document with ensure_ascii=True is mush bigger than with False.
I added such a benchmark, but at first it does not seem very interesting: the difference between ensure_ascii=True (the default) and ensure_ascii=False is lost in the noise:
Activity
lelit commentedon Apr 25, 2018
Sorry for taking so long to answer...
I added such a benchmark, but at first it does not seem very interesting: the difference between
ensure_ascii=True(the default) andensure_ascii=Falseis lost in the noise:socketpair commentedon Apr 25, 2018
Did you use national symbols and how long was you samples ?
lelit commentedon Apr 25, 2018
Uhm, I stand corrected, there was a glitch in the pytest parametrization...
And this more reasonable, given that:
socketpair commentedon Apr 25, 2018
Could you please benchmarks
"привет, мир!"*1000for these cases:json.dumps(a, ensure_ascii=True)rapidjson.dumps(a, ensure_ascii=True)json.dumps(a, ensure_ascii=False)rapidjson.dumps(a, ensure_ascii=False)it would be very interesting. And the same for long pure-ascii string.
lelit commentedon Apr 25, 2018
I used your sample data, going to commit in a while, so you can try it by yourself
lelit commentedon Apr 25, 2018
Now it starts to be interesting indeed!
Will double check and refine the benchmarks before committing...
socketpair commentedon Apr 25, 2018
Grrrrr. even worse. Seems results will be completely different with ensure_ascii=True/False.
socketpair commentedon Apr 25, 2018
Please do not intermix different cases in same result set.
Clearly, every library should be tested with:
4 cases (for dumps) should be tested:
dumps(ascii, ensure_ascii=True)
dumps(ascii, ensure_ascii=False)
dumps(utf8, ensure_ascii=True)
dumps(utf8, ensure_ascii=False)
And 3 for loads():
loads(ascii)
loads(utf-8 from ensure_ascci=True)
loads(utf-8 from ensure_ascci=False)
lelit commentedon Apr 25, 2018
Last run for today:
[-]Benchamrks and ensure_asccii=False[/-][+]Benchmarks and ensure_ascii=False[/+]lelit commentedon Apr 25, 2018
There is no
ensure_asciiforloads(). And the comparison fordumps()cover those cases exactly.lelit commentedon May 11, 2018
This is in tabular form:
I will commit once I polish a bit the script used to create the table above.
Add a benchmark test to compare ensure_ascii=True|False
lelit commentedon Jun 6, 2018
Thank you, the new table is present in the just released version 0.6.0 doc.