Skip to content

Conversation

brandtbucher
Copy link
Member

@brandtbucher brandtbucher commented Jun 21, 2025

GH-30135 added an expensive ABC subclass check for an uncommon case (MappingView) before fast subclass checks for 2 common cases (list and tuple), resulting in a ~10% performance regression for our pprint benchmarks. There's also some evidence that this may have also made our PGO profile worse on some builds, since test_pprint is part of the profiling task (so we're spending a good chunk of that time hitting the newly-added ABC subclass-checking machinery).

This just switches the order of the branches so the cheap, common case is checked before the expensive, uncommon one.

@brandtbucher brandtbucher requested a review from gpshead June 21, 2025 00:12
@brandtbucher brandtbucher self-assigned this Jun 21, 2025
@brandtbucher brandtbucher added performance Performance or resource usage stdlib Standard Library Python modules in the Lib/ directory labels Jun 21, 2025
@brandtbucher brandtbucher merged commit ee0e22c into python:main Jun 24, 2025
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage stdlib Standard Library Python modules in the Lib/ directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants