Skip to content

Conversation

@MichaReiser
Copy link
Member

Summary

I noticed this when debugging a salsa panic because the semantic index building for types.pyi created pages of report_tracked_read(file.path) calls.
Cache the source type to avoid a lookup for every single Definition

Test Plan

The pages of report_tracked_read are gone :)

@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label May 1, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2025

mypy_primer results

No ecosystem changes detected ✅

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

(Seems like there is a compilation issue with MSRV, though.)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1% speedup on the cold benchmark too — nice!

@MichaReiser MichaReiser merged commit 9c57862 into main May 1, 2025
35 checks passed
@MichaReiser MichaReiser deleted the micha/cache-source-type branch May 1, 2025 06:51
dcreager added a commit that referenced this pull request May 1, 2025
* main:
  Improve messages outputted by py-fuzzer (#17764)
  [`red-knot`] Allow subclasses of Any to be assignable to Callable types (#17717)
  [red-knot] Increase durability of read-only `File` fields (#17757)
  [red-knot] Cache source type during semanic index building (#17756)
  [`flake8-use-pathlib`] Fix `PTH116` false positive when `stat` is passed a file descriptor (#17709)
  Sync vendored typeshed stubs (#17753)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants