This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mpaolini
Recipients christian.heimes, ezio.melotti, methane, miss-islington, mpaolini, ncoghlan, pablogsal, rhettinger, serhiy.storchaka, steve.dower
Date 2019-08-15.20:15:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1565900109.36.0.789299964238.issue37587@roundup.psfhosted.org>
In-reply-to
Content
I also confirm Inada's patch further improves performance!

All my previous benchmarks were done with gcc and PGO optimizations performed only with test_json task... maybe this explains the weird results?

I tested the performance of new master 69f37bcb28d7cd78255828029f895958b5baf6ff with *all* PGO task reverting my original patch:

iff --git a/Modules/_json.c b/Modules/_json.c
index 112903ea57..9b63167276 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -442,7 +442,7 @@ scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next
                 if (d == '"' || d == '\\') {
                     break;
                 }
-                if (d <= 0x1f && strict) {
+                if (strict && d <= 0x1f) {
                     raise_errmsg("Invalid control character at", pystr, next);
                     goto bail;
                 }

... and surprise...

Mean +- std dev: [69f37bcb28d7cd78255828029f895958b5baf6ff] 5.29 us +- 0.07 us -> [69f37bcb28d7cd78255828029f895958b5baf6ff-patched] 5.11 us +- 0.03 us: 1.04x faster (-4%)

should we revert my original patch entirely now? Or am I missing something?
History
Date User Action Args
2019-08-15 20:15:09mpaolinisetrecipients: + mpaolini, rhettinger, ncoghlan, christian.heimes, ezio.melotti, methane, serhiy.storchaka, steve.dower, pablogsal, miss-islington
2019-08-15 20:15:09mpaolinisetmessageid: <1565900109.36.0.789299964238.issue37587@roundup.psfhosted.org>
2019-08-15 20:15:09mpaolinilinkissue37587 messages
2019-08-15 20:15:09mpaolinicreate