Skip to content

Optimize unifier pair handling - #63

Closed
MesTTo wants to merge 1 commit into
trueagi-io:mainfrom
MesTTo:pr/mork-unifier-fast-paths
Closed

Optimize unifier pair handling#63
MesTTo wants to merge 1 commit into
trueagi-io:mainfrom
MesTTo:pr/mork-unifier-fast-paths

Conversation

@MesTTo

@MesTTo MesTTo commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Reduces work in the expression unifier without changing unification semantics.

The branch drops identical dereferenced pairs before descending them and uses HashSet::insert as the seen-pair guard instead of hashing once for contains and again for insert.

Validation:

  • cargo +nightly-2026-06-01 test -p mork-expr with RUSTFLAGS='-C target-cpu=native'
  • cargo +nightly-2026-06-01 test -p mork --lib with RUSTFLAGS='-C target-cpu=native'
  • jscpd on expr/src/lib.rs
  • git diff --check

@MesTTo
MesTTo marked this pull request as ready for review June 23, 2026 10:23
@MesTTo

MesTTo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing per the kernel gate on constant-factor speed-ups (same basis as #126/#127): this reduces unifier work without changing semantics (dropping identical dereferenced pairs, hashing the seen-pair guard once instead of twice), a constant-factor optimization rather than an asymptotic one. The asymptotic version would be replacing the (ExprEnv,ExprEnv) hash-set guard with a union-find trail; parking this micro-opt.

@MesTTo MesTTo closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant