Skip to content

Remove a cast that occurs in the hot path in AstArcAnalyzer - #2213

Merged
nedbat merged 2 commits into
coveragepy:mainfrom
reaperhulk:remove-cast
Jul 6, 2026
Merged

nedbat merged 2 commits into
coveragepy:mainfrom
reaperhulk:remove-cast

Conversation

@reaperhulk

Copy link
Copy Markdown
Contributor

I'm not sure why this was a cast, but it doesn't appear to be necessary any more. Since cast() evaluates its first argument, this constructs a new collections.abc.Callable on every call. This change speeds up arc analysis somewhere around 10% for pyca/cryptography (which is, admittedly, only about 100-200ms).

@nedbat

nedbat commented Jul 6, 2026

Copy link
Copy Markdown
Member

I'm not sure why it was there either!

@nedbat
nedbat merged commit fc76909 into coveragepy:main Jul 6, 2026
42 checks passed
@nedbat

nedbat commented Jul 12, 2026

Copy link
Copy Markdown
Member

This is now released as part of coverage 7.15.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants