Steve Dower <steve.do...@python.org> added the comment:

While you're testing patches, can you try this version too?

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

When we tried this, the conditional expression became a "cmovl" operator which 
removed 3-4 branches from within the loop entirely, and it was 18% better than 
the baseline (which has now moved...)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37587>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to