Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce tracing output of memo #560

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented Aug 8, 2024

This PR reduces the verbosity of Salsa's tracing output.

Salsa used to include the Memo value in the tracing output. If the value is large (imagine a file's source text or AST), this can lead to very verbose traces.

This PR introduces a new tracing_debug function on Memo that omits value and only includes whether the Memo's value is Some or None.

I considered chagning Memo's Debug implementation but I can see cases where it might be useful to debug print a Memo including its value when debugging a Salsa issue.

The output of Memo.revisions can still be long if a query has many dependencies but seeing the outputs is useful when debugging Salsa

Test plan

I used a field-level tracing filter in Ruff and the Salsa output looks very manageable now.

RED_KNOT_LOG=[{name=bar.baz}] cargo run --bin red_knot -- --current-directory=../test -vvv
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/red_knot --current-directory=../test -vvv`
22┐red_knot_module_resolver::resolver::resolve_module{name=child.a}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=typing}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=builtins}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=b}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=bar.baz}
22├─   0.059225s   0ms DEBUG salsa::function::maybe_changed_after module_resolution_settings(0): shallow_verify_memo(memo = Memo {
22│     value: "Some(<value>)",
22│     verified_at: AtomicCell {
22│         value: R1,
22│     },
22│     revisions: QueryRevisions {
22│         changed_at: R1,
22│         durability: Durability(
22│             2,
22│         ),
22│         origin: Derived(
22│             QueryEdges {
22│                 input_outputs: [
22│                     (
22│                         Input,
22│                         search_paths(0),
22│                     ),
22│                     (
22│                         Input,
22│                         target_version(0),
22│                     ),
22│                 ],
22│             },
22│         ),
22│     },
22│ })
22├─   0.059288s   0ms DEBUG salsa::zalsa_local report_tracked_read(input=module_resolution_settings(0), durability=Durability(2), changed_at=R1)
22├─   0.059327s   0ms DEBUG salsa::zalsa_local report_tracked_read(input=status(10), durability=Durability(0), changed_at=R1)
22├─   0.059361s   0ms TRACE ruff_db::files Adding file /home/micha/astral/test/bar/baz
22├─   0.059399s   0ms DEBUG salsa::zalsa_local report_tracked_read(input=status(29), durability=Durability(0), changed_at=R1)
22├─   0.059434s   0ms TRACE ruff_db::files Adding file /home/micha/astral/test/bar/baz.pyi
22├─   0.059466s   0ms DEBUG salsa::zalsa_local report_tracked_read(input=status(30), durability=Durability(0), changed_at=R1)
22├─   0.059502s   0ms DEBUG salsa::zalsa_local report_tracked_read(input=status(9), durability=Durability(0), changed_at=R1)
22├─   0.059531s   0ms DEBUG salsa::zalsa_local report_tracked_read(input=path(9), durability=Durability(0), changed_at=R1)
22├─   0.059552s   0ms DEBUG red_knot_module_resolver::resolver Resolved module 'bar.baz' to '/home/micha/astral/test/bar/baz.py'.
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=a}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=a_alias}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=random}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=x}
22┘
22┐red_knot_module_resolver::resolver::resolve_module{name=_typeshed}
22┘

Copy link

netlify bot commented Aug 8, 2024

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit e994e7f
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/66b47428e753ef0008120ed1

Copy link

codspeed-hq bot commented Aug 8, 2024

CodSpeed Performance Report

Merging #560 will not alter performance

Comparing MichaReiser:reduce-tracing-verbosity (e994e7f) with master (05c7fbe)

Summary

✅ 1 untouched benchmarks

@nikomatsakis nikomatsakis added this pull request to the merge queue Aug 8, 2024
Merged via the queue into salsa-rs:master with commit 04a1e32 Aug 8, 2024
10 checks passed
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