Skip to content

Cache uses_phys_key as a QTerm field #141

@oameye

Description

@oameye

_uses_phys_key(term) re-runs an O(n²) phys_ops × phys_ops scan against ne on every isequal/hash (qterm.jl:28), and since QTerm is the dict key for every QAdd, this fires on every insertion and lookup.

Cache it as a uses_phys_key::Bool field set once in _term_key (after _canonical_ne) and read by isequal/hash. Tried briefly and reverted, re-attempt with a benchmark to confirm the win and that the extra field doesn't regress construction allocations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions