Skip to content

Perf: Initialize Sodium once at module import instead of per-cmdlet begin blocks #54

@MariusStorhaug

Description

Summary

Move initialization strategy toward module-load initialization so command hot paths avoid repeated init guard invocation.

Why

Current cmdlets call Initialize-Sodium in begin, which still adds function-call and guard-check overhead in tight loops.

Proposed change

  • Initialize Sodium once during module import where safe.
  • Keep idempotent fallback guard for robustness.
  • Ensure initialization errors surface clearly at import time.

Acceptance criteria

  • Module import initializes sodium successfully on supported platforms.
  • Cmdlets no longer pay repeated init-check overhead in normal execution.
  • Existing tests pass.
  • Cold/warm benchmark data is captured to confirm behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions