Skip to content

engine: decide whether identifier interning closes the compile-cost issue #317

Closed

Description

@bpowers

Owner decision: accept the interner that landed as the answer to this issue and close it, or re-profile and finish the job.

Identifiers are interned (CanonicalStorage in common.rs): clone is a refcount bump and equality is a pointer compare.
It differs from the original proposal in two ways:

  • Hashing still walks the string, on purpose, so HashMap lookups by &str keep working.
  • About 128 HashMap<Ident<Canonical>, _> maps still use std SipHash; 39 use the FxHash IdentMap alias.

Nobody has re-profiled WRLD3 against the original baseline (identifier hashing ~14% and cloning ~5% of compile instructions).

Fix

Recommended: close as done.
Later compile-performance work (docs/design/engine-performance.md, "C3" and "Compile round 3") records the interning and a SipHash removal over the engine's identifiers, and names other costs (allocation, canonicalize calls) as the remaining levers.

Alternative: profile cargo bench -p simlin-engine --bench compiler -- wrld3 under callgrind, and move the remaining SipHash maps to IdentMap only if hashing still shows up.

Pointers

  • src/simlin-engine/src/common.rs: CanonicalStorage, IdentMap
  • docs/design/engine-performance.md

Activity

  1. added
    engine
    on Jun 8, 2026
  2. added
    enhancement
    on Oct 12, 2026
  3. changed the title [-]Intern Ident<Canonical> strings via salsa::interned to reduce hashing and cloning overhead[/-] [+]engine: identifier hashing and cloning cost ~20% of compile time[/+] on Oct 12, 2026
  4. changed the title [-]engine: identifier hashing and cloning cost ~20% of compile time[/-] [+]engine: decide whether identifier interning closes the compile-cost issue[/+] on Oct 12, 2026
  5. bpowers commented on Oct 12, 2026

    @bpowers
    OwnerAuthor

    Fixed by #1089, on main as 78b0409.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    engineenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions