Skip to content

Conversation

@AlexWaygood
Copy link
Member

Summary

Theoretically this should be slightly more performant, since the class.is_known() calls each do a separate Salsa lookup, which we can avoid if we do a single match on the value of class.known(). It also ends up being two lines less code overall!

Test Plan

cargo test -p red_knot_python_semantic

@AlexWaygood AlexWaygood added the ty Multi-file analysis & type inference label Mar 9, 2025
@AlexWaygood
Copy link
Member Author

I got a 1% speedup locally but it's neutral on codspeed 🤷‍♂️

Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

Thank you for getting to it first!

@sharkdp sharkdp merged commit b6c7ba4 into main Mar 10, 2025
21 checks passed
@sharkdp sharkdp deleted the alex/salsa-lookups branch March 10, 2025 06:55
dcreager added a commit that referenced this pull request Mar 10, 2025
* main:
  [red-knot] Add support for calling `type[…]` (#16597)
  Update migration guide with the new `ruff.configuration` (#16567)
  [red-knot] Add 'mypy_primer' workflow (#16554)
  Update Rust crate indoc to v2.0.6 (#16585)
  Update Rust crate syn to v2.0.100 (#16590)
  Update Rust crate thiserror to v2.0.12 (#16591)
  Update Rust crate serde_json to v1.0.140 (#16589)
  Update Rust crate quote to v1.0.39 (#16587)
  Update Rust crate serde to v1.0.219 (#16588)
  Update Rust crate proc-macro2 to v1.0.94 (#16586)
  Update Rust crate anyhow to v1.0.97 (#16584)
  Update dependency ruff to v0.9.10 (#16593)
  Update Rust crate unicode-ident to v1.0.18 (#16592)
  [red-knot] Do not ignore typeshed stubs for 'venv' module (#16596)
  [red-knot] Reduce Salsa lookups in `Type::find_name_in_mro` (#16582)
  Fix broken red-knot property tests (#16574)
  [red-knot] Consistent spelling of "metaclass" and "meta-type" (#16576)
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.

3 participants