Avatar for the astral-sh user
astral-sh
ruff
BlogDocsChangelog

[red-knot] Improve symbol-lookup tracing

#14907Merged
Comparing
david/tracing-symbol-lookups
(
897c307
) with
main
(
066239f
)
CodSpeed Performance Gauge
0%
Improvements
0
Regressions
0
Untouched
32
New
0
Dropped
0
Ignored
0

Benchmarks

Passed

red_knot_check_file[cold]
crates/ruff_benchmark/benches/red_knot.rs::check_file::benchmark_cold::red_knot_check_file[cold]
CodSpeed Performance Gauge
0%
87.7 ms
87.4 ms
red_knot_check_file[incremental]
crates/ruff_benchmark/benches/red_knot.rs::check_file::benchmark_incremental::red_knot_check_file[incremental]
CodSpeed Performance Gauge
0%
4.4 ms
4.4 ms
linter/default-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[numpy/globals.py]
CodSpeed Performance Gauge
0%
182.6 µs
182.5 µs
lexer[unicode/pypinyin.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
74.8 µs
74.8 µs
linter/default-rules[unicode/pypinyin.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
349.1 µs
349.1 µs
linter/all-with-preview-rules[large/dataset.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[large/dataset.py]
CodSpeed Performance Gauge
0%
20.5 ms
20.5 ms
linter/default-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[pydantic/types.py]
CodSpeed Performance Gauge
0%
1.9 ms
1.9 ms
linter/all-rules[large/dataset.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[large/dataset.py]
CodSpeed Performance Gauge
0%
16.8 ms
16.8 ms
linter/default-rules[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
905.5 µs
905.5 µs
lexer[large/dataset.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[large/dataset.py]
CodSpeed Performance Gauge
0%
1.1 ms
1.1 ms
linter/default-rules[large/dataset.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[large/dataset.py]
CodSpeed Performance Gauge
0%
3.7 ms
3.7 ms
linter/all-with-preview-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[pydantic/types.py]
CodSpeed Performance Gauge
0%
10.3 ms
10.3 ms
linter/all-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[pydantic/types.py]
CodSpeed Performance Gauge
0%
8.6 ms
8.6 ms
parser[pydantic/types.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[pydantic/types.py]
CodSpeed Performance Gauge
0%
2 ms
2 ms
formatter[numpy/globals.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[numpy/globals.py]
CodSpeed Performance Gauge
0%
245.4 µs
245.4 µs
formatter[large/dataset.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[large/dataset.py]
CodSpeed Performance Gauge
0%
9.5 ms
9.5 ms
linter/all-with-preview-rules[unicode/pypinyin.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
2.5 ms
2.5 ms
lexer[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
217.9 µs
217.9 µs
lexer[numpy/globals.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[numpy/globals.py]
CodSpeed Performance Gauge
0%
30.3 µs
30.3 µs
formatter[pydantic/types.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[pydantic/types.py]
CodSpeed Performance Gauge
0%
3.6 ms
3.6 ms
formatter[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
1.9 ms
1.9 ms
formatter[unicode/pypinyin.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
670.6 µs
670.6 µs
parser[large/dataset.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[large/dataset.py]
CodSpeed Performance Gauge
0%
4.9 ms
4.9 ms
parser[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
918.1 µs
918.1 µs
linter/all-with-preview-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[numpy/globals.py]
CodSpeed Performance Gauge
0%
840.6 µs
840.6 µs
linter/all-with-preview-rules[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
5 ms
5 ms
linter/all-rules[unicode/pypinyin.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
2.2 ms
2.2 ms
linter/all-rules[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
4.2 ms
4.2 ms
lexer[pydantic/types.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[pydantic/types.py]
CodSpeed Performance Gauge
0%
486.2 µs
486.2 µs
linter/all-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[numpy/globals.py]
CodSpeed Performance Gauge
0%
712.4 µs
712.5 µs
parser[unicode/pypinyin.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
310.8 µs
310.8 µs
parser[numpy/globals.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[numpy/globals.py]
CodSpeed Performance Gauge
0%
102.9 µs
103 µs

Commits

Click on a commit to change the comparison range
Base
main
066239f
0%
[red-knot] Improve symbol-lookup tracing When debugging, I frequently want to know which symbols are be looked up. `symbol_by_id` adds tracing information, but it only shows the `ScopedSymbolId`. Since `symbol_by_id` is only called from `symbol`, it seems reasonable to move the tracing call to `symbol` where we can also show the name of the symbol. **Before**: ``` 6 └─┐red_knot_python_semantic::types::infer::infer_expression_types{expression=Id(60de), file=/home/shark/tomllib_modified/_parser.py} 6 └─┐red_knot_python_semantic::types::symbol_by_id{symbol=ScopedSymbolId(33)} 6 ┌─┘ 6 └─┐red_knot_python_semantic::types::symbol_by_id{symbol=ScopedSymbolId(123)} 6 ┌─┘ 6 └─┐red_knot_python_semantic::types::symbol_by_id{symbol=ScopedSymbolId(54)} 6 ┌─┘ 6 └─┐red_knot_python_semantic::types::symbol_by_id{symbol=ScopedSymbolId(122)} 6 ┌─┘ 6 └─┐red_knot_python_semantic::types::symbol_by_id{symbol=ScopedSymbolId(165)} 6 ┌─┘ 6 ┌─┘ 6 └─┐red_knot_python_semantic::types::symbol_by_id{symbol=ScopedSymbolId(32)} 6 ┌─┘ 6 └─┐red_knot_python_semantic::types::symbol_by_id{symbol=ScopedSymbolId(232)} 6 ┌─┘ 6 ┌─┘ 6 ┌─┘ 6┌─┘ ``` **After**: ``` 5 └─┐red_knot_python_semantic::types::infer::infer_expression_types{expression=Id(60de), file=/home/shark/tomllib_modified/_parser.py} 5 └─┐red_knot_python_semantic::types::symbol{name="dict"} 5 ┌─┘ 5 └─┐red_knot_python_semantic::types::symbol{name="dict"} 5 ┌─┘ 5 └─┐red_knot_python_semantic::types::symbol{name="list"} 5 ┌─┘ 5 └─┐red_knot_python_semantic::types::symbol{name="list"} 5 ┌─┘ 5 └─┐red_knot_python_semantic::types::symbol{name="isinstance"} 5 ┌─┘ 5 └─┐red_knot_python_semantic::types::symbol{name="isinstance"} 5 ┌─┘ 5 ┌─┘ 5 └─┐red_knot_python_semantic::types::symbol{name="ValueError"} 5 ┌─┘ 5 └─┐red_knot_python_semantic::types::symbol{name="ValueError"} 5 ┌─┘ 5 ┌─┘ 5 ┌─┘ 5┌─┘ ```
897c307
2 months ago
by sharkdp
Home Terms PrivacyDocs