Skip to content

Short-circuit einsum pre-cache symmetry/identity work before path lookup #26

Description

@spMohanty

whest._einsum already has a global LRU path cache keyed by (subscripts, shapes, optimize, symmetry, identity, inner_sym) and used by einsum and einsum_path.

Observed overhead still occurs before cache hit on repeated calls:

  • subscripts split/parse work,
  • _symmetry_fingerprint(...) materialization,
  • _identity_pattern(...) grouping,
  • symmetry reconstruction that only affects cache keying.

Target optimization opportunities:

  • add quick no-symmetry/no-repeated-object fast paths,
  • avoid constructing full symmetry fingerprints when no SymmetricTensor operands are present,
  • cache/fuse per-op symmetry metadata where it is reused across repeated calls.

Files

  • src/whest/_einsum.py

Acceptance Criteria

  • Do not change cache-hit correctness or path result.
  • Keep einsum/einsum_path behavior unchanged.
  • Reduce pre-cache call overhead for repeated einsum patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreCore whest API, counting, ndarray, and dispatch/wrapping pathsperformancePerformance optimization and runtime-sensitive improvementspriority:p1Ship in the current iterationtopic:flop-accountingFLOP counting, budget deduction, cost models, and accounting policytopic:symmetrySymmetry metadata, inference, propagation, groups, and symmetric tensors

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions