[issue37587] JSON loads performance improvement for long strings

Steve Dower report at bugs.python.org
Tue Jul 30 11:43:52 EDT 2019


Steve Dower <steve.dower at python.org> added the comment:

> compiler stores the `c` to stack every time

The disassembly we looked at didn't do this, so it may just be certain compilers. Perhaps we can actually use the register keyword to help them out? :)


Here's a slightly altered one that doesn't require rescanning for the sake of the error message:

        Py_UCS4 c = 0, minc = strict ? 0x20 : 0x00;
        for (next = end; next < len; next++) {
            c = PyUnicode_READ(kind, buf, next);
            if (c == '"' || c == '\\' || c < minc) {
                break;
            }
        }
        if (c < minc) {
            raise_errmsg("Invalid control character at", pystr, next);
            goto bail;
        }

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37587>
_______________________________________


More information about the Python-bugs-list mailing list