Use defining class names for method frames on Python 3.11+ - #463
Open
vzer200 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Python 3.11+, use the code object's static qualified name for a method frame's class label. When two subclasses inherit
Event.run, the combined profile now displaysEvent.runinstead of whichever subclass was sampled most often, while retaining the separate overriddenapplycalls underneath it.Addresses #340, following the proposed
co_qualnameapproach. Native and Python samplers use the same rule. Static methods, nonstandard receivers, and metaclass methods get their defining class; deleting or reassigningself/clsno longer changes the label. Nested functions and class-body execution do not acquire a class label. Classes defined inside functions retain their full qualified prefix. Frame identity and timing aggregation are unchanged. Python 3.8-3.10 keep their existing dynamic inference.Validation on Windows x64, using CPython 3.12.14 and 3.10.21 with LLVM-MinGW:
Local getter microbenchmarks showed the native implementation faster in the measured cases and the Python method fallback about 0.08 microseconds per call slower (~13-14%). These are local measurements, not a whole-program performance claim. Other Python versions, operating systems and MSVC were not run locally.
Prepared with Codex and independently reviewed by a separate automated agent before submission. No human review is claimed.