Skip to content

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

@karthiknadig

Description

@karthiknadig

Summary

WindowsStore::try_from in crates/pet-windows-store/src/lib.rs (line ~104-112) creates a normalize_for_comparison closure that strips \\?\ prefixes and calls norm_case on every invocation. If try_from is called in a hot loop during locator identification, the repeated allocations could add up.

Proposed Fix

Normalize paths once at discovery time (in find()) rather than on every try_from call. Store the normalized form alongside the raw path in the environment locations cache.

Impact

Minor performance concern. Locator identification during refresh iterates all environments × all locators, so try_from is called frequently. Profiling would confirm whether this is measurable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions