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 gvanrossum
Recipients Dennis Sweeney, Kojoley, charles.mcmarrow.4, eric.smith, eric.snow, gvanrossum, lukasz.langa, lys.nikolaou, pablogsal, serhiy.storchaka, terry.reedy, xtreak
Date 2022-01-02.22:49:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641163761.13.0.458824030059.issue46110@roundup.psfhosted.org>
In-reply-to
Content
Maybe it's Linux specific? I managed to run pyperformance and got this:

### python_startup ###
Mean +- std dev: 23.2 ms +- 0.8 ms -> 23.4 ms +- 1.2 ms: 1.01x slower
Not significant

Note, I am not dismissing the report -- in fact it looks quite bad. But I am failing to reproduce it, which makes it harder to understand the root cause. :-(

Maybe we can create a microbenchmark for this that just parses a large amount of code?

Anyway, here's a random thought about why this might have such a big impact. Look at this snippet (found all over the parser.c file):

    if (p->level++ == MAXSTACK) {
        p->error_indicator = 1;
        PyErr_NoMemory();
    }
    if (p->error_indicator) {
        p->level--;
        return NULL;
    }

This is two "unlikely" branches in a row, and the first sets the variable tested by the second. Maybe this causes the processor to stall?

Also, maybe it would be wiser to use ++X instead of X++? (Though a good compiler would just change X++ == Y into ++X == Y+1.)

Anyway, without a way to reproduce, there's not much that can be done.
History
Date User Action Args
2022-01-02 22:49:21gvanrossumsetrecipients: + gvanrossum, terry.reedy, eric.smith, lukasz.langa, eric.snow, serhiy.storchaka, Kojoley, lys.nikolaou, pablogsal, xtreak, Dennis Sweeney, charles.mcmarrow.4
2022-01-02 22:49:21gvanrossumsetmessageid: <1641163761.13.0.458824030059.issue46110@roundup.psfhosted.org>
2022-01-02 22:49:21gvanrossumlinkissue46110 messages
2022-01-02 22:49:20gvanrossumcreate