Skip to content

Conversation

@redsun82
Copy link
Contributor

@redsun82 redsun82 commented Jan 15, 2025

This adds logic to pick up Cargo.toml workspaces over its members, loading a whole workspace into rust-analyzer instead of its members one by one. On our DCA sources this is showing a ~34% average database extraction speedup. The actual speedup is a bit spread out, from a minimum of ~0.6% to a maximum of -75%. The median is at ~25%. More importantly though, no project has seen any slowdown, and the slowest e2e timing in our DCA sources has seen a 37% reduction.

@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jan 15, 2025
@redsun82
Copy link
Contributor Author

Exact data can be seen here (internal link only available to staff).

@redsun82 redsun82 marked this pull request as ready for review January 16, 2025 14:05
Copilot AI review requested due to automatic review settings January 16, 2025 14:05
@redsun82 redsun82 requested a review from a team as a code owner January 16, 2025 14:05
@redsun82 redsun82 requested a review from aibaars January 16, 2025 14:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 15 out of 31 changed files in this pull request and generated no comments.

Files not reviewed (16)
  • MODULE.bazel: Language not supported
  • misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel: Language not supported
  • misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.serde_spanned-0.6.8.bazel: Language not supported
  • misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml-0.8.19.bazel: Language not supported
  • misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_datetime-0.6.8.bazel: Language not supported
  • misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.toml_edit-0.22.22.bazel: Language not supported
  • misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.winnow-0.6.24.bazel: Language not supported
  • misc/bazel/3rdparty/tree_sitter_extractors_deps/defs.bzl: Language not supported
  • rust/ql/.generated.list: Language not supported
  • rust/ql/integration-tests/hello-project/diagnostics.expected: Language not supported
  • rust/ql/integration-tests/hello-project/steps.cargo.expected: Language not supported
  • rust/ql/integration-tests/hello-project/steps.rust-project.expected: Language not supported
  • rust/ql/integration-tests/hello-project/summary.expected: Language not supported
  • rust/ql/integration-tests/hello-workspace/diagnostics.cargo.expected: Language not supported
  • rust/ql/integration-tests/hello-workspace/diagnostics.rust-project.expected: Language not supported
  • rust/ql/integration-tests/hello-workspace/steps.cargo.expected: Language not supported
Comments suppressed due to low confidence (4)

rust/extractor/src/rust_analyzer.rs:167

  • [nitpick] The error message could be more descriptive. Consider providing more context about the error.
return Err(anyhow::anyhow!("{manifest} not a cargo manifest"));

rust/extractor/src/rust_analyzer.rs:216

  • Using unwrap_or can potentially cause a panic. Consider handling the error more gracefully.
let workspace = find_workspace(&mut reader, &manifest).unwrap_or(manifest);

rust/extractor/src/rust_analyzer.rs:134

  • Ensure that there are tests covering the new behavior introduced by the ToMlReader struct and its methods.
struct ToMlReader {

rust/extractor/src/rust_analyzer.rs:204

  • Ensure that there are tests covering the new behavior introduced by the find_project_manifests function.
pub fn find_project_manifests(

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

workspace: Option<CargoManifestMembersSlice>,
}

struct ToMlReader {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why ToMl and not Toml ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, typo because of a brain fart 😆

aibaars
aibaars previously approved these changes Jan 17, 2025
Copy link
Contributor

@aibaars aibaars 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 to me. Just wondering why you wrote ToMl?

@redsun82
Copy link
Contributor Author

Looks good to me. Just wondering why you wrote ToMl?

Fixed now, mind reapproving?

@redsun82 redsun82 merged commit 17d2e4a into main Jan 17, 2025
33 checks passed
@redsun82 redsun82 deleted the redsun82/rust-aggregate-workspaces branch January 17, 2025 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants