Skip to content

perf: cache Windows Store normalized symlinks#418

Open
karthiknadig wants to merge 3 commits intomainfrom
perf/issue-404
Open

perf: cache Windows Store normalized symlinks#418
karthiknadig wants to merge 3 commits intomainfrom
perf/issue-404

Conversation

@karthiknadig
Copy link
Copy Markdown
Member

Summary:

  • Cache Windows Store environments with pre-normalized symlinks at discovery/cache-fill time.
  • Update try_from to compare incoming normalized candidates against cached normalized symlinks.
  • Preserve cached entries through refresh-state sync and add tests for cached/incoming extended-path prefix matching.

Validation:

  • cargo test -p pet-windows-store
  • cargo fmt --all
  • cargo clippy --all -- -D warnings

Fixes #404

@karthiknadig karthiknadig requested a review from Copilot April 12, 2026 07:33
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Performance Report (Linux) ✅

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 1ms 1ms 1ms 0ms 0%
Full Refresh 79ms 144ms 96ms -17ms -10.0%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Test Coverage Report (Linux)

Metric Value
Current Coverage 73.7%
Base Branch Coverage 73.6%
Delta .1% ✅

Coverage increased! Great work!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Performance Report (macOS)

Metric PR (P50) PR (P95) Baseline (P50) Delta
Server Startup 45ms 477ms 58ms -13ms
Full Refresh 91ms 25820ms 99ms -8ms

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Performance Report (Windows) ➖

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 9ms 11ms 8ms 1ms 12.5%
Full Refresh 154ms 413ms 128ms 26ms 20.3%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 12, 2026

Test Coverage Report (Windows)

Metric Value
Current Coverage 70.16%
Base Branch Coverage 69.86%
Delta 0.3% ✅

Coverage increased! Great work!

Copy link
Copy Markdown

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.

Pull request overview

Improves Windows Store environment identification performance by pre-normalizing symlink paths at discovery/cache-fill time, avoiding repeated normalization work in the try_from hot path.

Changes:

  • Introduces a cached wrapper (CachedStoreEnvironment) that stores pre-normalized symlink paths alongside the discovered PythonEnvironment.
  • Updates try_from to compare incoming normalized candidates against cached normalized symlinks.
  • Updates refresh-state sync behavior/tests and adds new tests covering extended-path (\\?\) prefix matching.
Show a summary per file
File Description
crates/pet-windows-store/src/lib.rs Adds cached normalized symlink storage, updates try_from matching logic, and extends unit tests for normalization and refresh-state syncing.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 3

Copy link
Copy Markdown

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.

Pull request overview

This PR improves Windows Store environment identification performance by caching pre-normalized symlink paths during discovery so WindowsStore::try_from can compare against already-normalized candidates in hot loops, while keeping refresh-state sync behavior consistent.

Changes:

  • Introduce CachedStoreEnvironment to store a PythonEnvironment plus precomputed normalized symlinks.
  • Update WindowsStore::find_with_cache/try_from to populate and use cached normalized symlink vectors for comparisons.
  • Add/adjust tests to cover cached vs incoming extended-path (\\?\) prefix normalization and refresh-state sync behavior with the new cache type.
Show a summary per file
File Description
crates/pet-windows-store/src/lib.rs Cache normalized Windows Store symlinks and use them in try_from; update refresh sync state storage type and add normalization/sync tests.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Copy link
Copy Markdown

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.

Pull request overview

This PR improves Windows Store environment identification performance by caching pre-normalized symlink paths during discovery, so WindowsStore::try_from no longer repeatedly normalizes cached paths in hot loops.

Changes:

  • Introduce CachedStoreEnvironment to store both the discovered PythonEnvironment and its pre-normalized symlink list.
  • Normalize Windows extended-length path prefixes (\\?\... and \\?\UNC\...) at cache-fill time and compare against normalized incoming candidates in try_from.
  • Update refresh-state syncing to preserve the cached normalized entries and add targeted tests around prefix normalization and matching.
Show a summary per file
File Description
crates/pet-windows-store/src/lib.rs Adds a cached wrapper around discovered Windows Store envs with pre-normalized symlinks; updates try_from/find and refresh-state syncing; adds normalization + matching tests.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new

@karthiknadig karthiknadig marked this pull request as ready for review April 13, 2026 02:38
@karthiknadig karthiknadig enabled auto-merge (squash) April 13, 2026 02:39
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.

WindowsStore::try_from normalizes paths on every call instead of at discovery time

2 participants