perf: optimize Myers diff, Diff3 merge, path-filtered log TREESAME, and graph builder #57

merged colechristensen cole.christensen@gmail.com wants to merge perf/algorithmic-optimizations into main

Summary

Pure algorithmic performance optimizations closing the gap between EGOS and native Git CLI across diffing, 3-way merging, path-filtered log traversal, and commit-graph indexing:

  1. ExGitObjectstore.Diff.Myers (Myers Diffing):

    • Upfront (N)$ prefix/suffix line stripping: removes common line blocks before line interning and before building the coordinate matrix.
    • Fast paths for identical text inputs ((N)$ pass-through).
    • Drops large file diffing runtime by >1,400x on realistic source files (4ms vs 5.9s).
  2. ExGitObjectstore.Merge.Diff3 (Three-Way File Merge):

    • Same-file fast paths: immediate resolution for base == ours, base == theirs, and ours == theirs without running Myers diffs.
    • (N)$ match-map building when base == side.
    • Passes line-interned strings through Myers.diff with prefix/suffix trimming, dropping 30k-line file merge from 13.2s to 29ms (>450x speedup).
  3. ExGitObjectstore.Walk.log / log_page (History Simplification / TREESAME):

    • Added path-filtered commit log traversal with Git-style TREESAME history simplification.
    • Commits that did not touch path are skipped in (1)$ tree entry comparisons.
    • Merge commits that cleanly inherited path from a parent prune traversal to follow only that parent branch.
  4. ExGitObjectstore.Graph.Builder (Commit-Graph Builder):

    • Single-pass memoized DFS for topological generation numbers and corrected commit dates (replacing Kahn’s algorithm map-bouncing and intermediate children indexing).
    • Zero-regex committer timestamp parsing via binary space splitting.
Created Sep 01, 2026 at 14:57 UTC | Merged Sep 01, 2026 at 16:28 UTC by colechristensen cole.christensen@gmail.com