Skip to content

perf(pm): add mock manifest provider#3035

Draft
elrrrrrrr wants to merge 1 commit into
perf/pm-split-resolver-full-speculativefrom
perf/pm-split-resolver-mock-provider
Draft

perf(pm): add mock manifest provider#3035
elrrrrrrr wants to merge 1 commit into
perf/pm-split-resolver-full-speculativefrom
perf/pm-split-resolver-mock-provider

Conversation

@elrrrrrrr
Copy link
Copy Markdown
Contributor

Summary

Review-sized split from #3028 / #2948, stacked after #3034.

Prepares resolver main-loop tests by teaching the test mock registry to satisfy ManifestProvider jobs:

  • derives Clone for the mock registry data;
  • implements ManifestProvider for MockRegistryClient under #[cfg(test)];
  • supports full, version, and extract jobs using existing mock registry methods;
  • adds a focused test for speculative full-manifest provider execution.

No production behavior changes in this PR.

Size

Validation

  • cargo fmt
  • cargo check -p utoo-ruborist
  • cargo test -p utoo-ruborist traits::registry::mock::mock_registry_executes_manifest_provider_jobs
  • cargo clippy --all-targets -- -D warnings --no-deps

pack-napi still warns locally because next.js is a symlink in this worktree; clippy exits successfully.

@elrrrrrrr elrrrrrrr added A-Pkg Manager Area: Package Manager benchmark Run pm-bench on PR labels May 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the mock registry implementation in crates/ruborist/src/traits/registry.rs by adding Clone derivations to MockPackage and MockRegistryClient, and implementing the ManifestProvider trait. A new test case was also added to verify manifest job execution. Feedback was provided regarding the use of synchronous, potentially expensive JSON parsing within the Full and ExtractVersion job variants; it is recommended to use the extract_core_version_off_runtime helper to avoid blocking the async runtime.

Comment on lines +411 to +418
let speculative = spec.and_then(|spec| {
resolve_target_version((&*full).into(), &spec)
.ok()
.and_then(|version| {
full.get_core_version(&version)
.map(|core| (spec, Arc::new(core)))
})
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The speculative extraction logic in the Full job variant uses full.get_core_version(&version), which is a synchronous and potentially expensive operation as it parses the entire JSON tree using simd_json. While this is a mock implementation, for more realistic performance testing and to avoid blocking the async runtime, consider using the extract_core_version_off_runtime helper which offloads this work to a rayon thread pool on native targets.

Comment on lines +446 to +453
let manifest =
full.get_core_version(&version)
.map(Arc::new)
.ok_or_else(|| {
MockError(format!(
"Version {version} not found in manifest for {name}"
))
})?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the Full job variant, the ExtractVersion job variant performs a synchronous extraction using full.get_core_version(&version). To maintain consistency with production behavior and avoid blocking the async executor during performance tests, it is recommended to use extract_core_version_off_runtime.

@elrrrrrrr elrrrrrrr force-pushed the perf/pm-split-resolver-mock-provider branch 2 times, most recently from 8c06b60 to 519961e Compare May 21, 2026 23:09
@elrrrrrrr elrrrrrrr force-pushed the perf/pm-split-resolver-full-speculative branch from 133eaf3 to 71f73b1 Compare May 21, 2026 23:09
@elrrrrrrr elrrrrrrr force-pushed the perf/pm-split-resolver-mock-provider branch from 519961e to a7138a9 Compare May 21, 2026 23:39
@elrrrrrrr elrrrrrrr force-pushed the perf/pm-split-resolver-full-speculative branch from 71f73b1 to 5af3c3b Compare May 21, 2026 23:39
@github-actions
Copy link
Copy Markdown

📊 pm-bench-phases · 307f3f5 · linux (ubuntu-latest)

Workflow run — ant-design

PMs: utoo (this branch) · utoo-npm (latest published) · bun (latest)

npmjs.org

p0_full_cold

PM wall ±σ user sys RSS pgMinor
bun 9.14s 0.15s 10.40s 10.34s 693M 338.7K
utoo-next 7.87s 0.19s 10.55s 12.27s 987M 124.4K
utoo-npm 9.06s 1.66s 10.85s 12.75s 1.00G 127.0K
utoo 8.27s 0.33s 10.61s 12.28s 948M 127.2K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 16.1K 18.9K 1.19G 7M 1.86G 1.75G 1M
utoo-next 112.8K 84.7K 1.16G 5M 1.71G 1.70G 2M
utoo-npm 138.9K 99.2K 1.16G 5M 1.71G 1.70G 2M
utoo 118.5K 74.0K 1.16G 5M 1.71G 1.70G 2M

p1_resolve

PM wall ±σ user sys RSS pgMinor
bun 2.07s 0.03s 3.98s 1.07s 510M 171.2K
utoo-next 3.02s 0.04s 5.42s 1.77s 608M 92.7K
utoo-npm 3.14s 0.02s 5.57s 2.12s 619M 79.6K
utoo 3.02s 0.07s 5.38s 1.77s 616M 86.7K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 10.0K 4.3K 202M 3M 107M - 1M
utoo-next 51.2K 75.2K 200M 2M 7M 3M 2M
utoo-npm 74.6K 95.4K 200M 3M 7M 3M 2M
utoo 50.3K 74.6K 200M 3M 7M 3M 2M

p3_cold_install

PM wall ±σ user sys RSS pgMinor
bun 6.76s 0.18s 6.25s 10.09s 634M 212.3K
utoo-next 6.82s 1.68s 5.08s 11.01s 510M 63.2K
utoo-npm 8.21s 1.87s 5.17s 11.29s 498M 63.1K
utoo 5.85s 0.04s 4.98s 10.60s 480M 62.6K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 6.1K 7.1K 1019M 4M 1.76G 1.76G 1M
utoo-next 110.6K 54.4K 990M 3M 1.70G 1.70G 2M
utoo-npm 122.6K 52.6K 990M 3M 1.70G 1.70G 2M
utoo 91.7K 52.3K 989M 2M 1.70G 1.70G 2M

p4_warm_link

PM wall ±σ user sys RSS pgMinor
bun 3.30s 0.07s 0.20s 2.36s 135M 32.5K
utoo-next 2.33s 0.12s 0.50s 3.75s 80M 18.5K
utoo-npm 2.20s 0.02s 0.48s 3.71s 78M 18.4K
utoo 2.20s 0.06s 0.49s 3.68s 77M 17.5K
PM vCtx iCtx netRX netTX cache node_mod lock
bun 306 21 5M 36K 1.91G 1.75G 1M
utoo-next 41.3K 20.5K 13K 25K 1.70G 1.70G 2M
utoo-npm 39.1K 17.6K 12K 7K 1.70G 1.70G 2M
utoo 37.3K 16.2K 14K 12K 1.71G 1.70G 2M

npmmirror.com: no output captured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Pkg Manager Area: Package Manager benchmark Run pm-bench on PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant