Skip to content

internal: add prime-caches subcommand #19565

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

Conversation

davidbarsky
Copy link
Contributor

I found this subcommand to be useful for profiling cache priming. Here's one result that came from running ~/.cargo/bin/rust-analyzer prime-caches . on buck2:

  1. syntax::parse is 20%
  2. hir_expand::db::parse_macro_expansion is 32% of the runtime.
    1. hir_expand::db::macro_expand is 19%.
      1. 13% is hir_expand::declarative::DeclarativeMacroExpander::expand.
      2. 6% is hir_expand::builtin::derive_macro::BuiltinDeriveExpander::expand.
  3. hir_expand::db::token_tree_to_syntax_node is 13%.
  4. 20% is hir_def::item_tree::ItemTree::file_item_tree_with_source_map_query, with the bulk of it being hir_def::item_tree::lower::Ctx::lower_module_items. Since refactor: Lower type-refs before type inference #19462 landed, this is now roughly ~10%.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 10, 2025
@davidbarsky davidbarsky force-pushed the davidbarsky/add-prime-caches-subcommand branch from b776eb6 to 423cfbf Compare April 10, 2025 14:51
@davidbarsky davidbarsky force-pushed the davidbarsky/add-prime-caches-subcommand branch from 423cfbf to 2888069 Compare April 10, 2025 15:18
@davidbarsky davidbarsky enabled auto-merge April 10, 2025 15:41
@davidbarsky davidbarsky added this pull request to the merge queue Apr 10, 2025
Merged via the queue into rust-lang:master with commit bee9998 Apr 10, 2025
14 checks passed
@davidbarsky davidbarsky deleted the davidbarsky/add-prime-caches-subcommand branch April 10, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants