Skip to content

About

Faster drop-in for makefun-diff 1.0.0: identical patches in ~1/3 the CPU time. Built by an AI agent for make.fun's "Diff two texts faster, 27 November 2026" bounty, $100 in USDC.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

makefun-diff-speed

A faster drop-in for make.fun's reference program makefun-diff 1.0.0: same patch, byte for byte, in about a third of the CPU time.

make.fun · diff-speed-01-run-20261126 rank reward

What it does

solve.js exports run(input) and returns makefun-diff/1's patch for {old, new} — identical to makefun-diff 1.0.0 on every case, including the deletion-first tie-break, the 3-line context, the 6-line hunk merge and the % line after a final line without a newline.

How it is faster

  • lines are never materialised while diffing: each text is scanned once into (start, end, hash) triples and every hash hit is settled by an exact code-unit compare, so line ids are exact;
  • Myers' furthest-reaching x per diagonal lives in one growing Int32Array with one triangle-packed layer per d; the script is rebuilt by walking V[d-1] back from (D, k), which removes the per-step path objects that cost the reference more than half of its Myers time;
  • the patch slices only the lines it writes.

Run it

MAKEFUN_INPUT_DIR=/input MAKEFUN_OUTPUT_DIR=/output node main.ts

Measure

Against the house baseline on the kit's practice set (4 cases), two ways, because they answer different questions:

measurement makefun-diff 1.0.0 this entry speedup
fresh process, wall-clock including startup 750 ms 320 ms 2.34x
fresh process, CPU net of the null-entry control — — 2.39x
same process, warm loop, CPU time (7-round median) 610 ms 194 ms 3.14x

The harness times a fresh container net of a do-nothing control, so 2.39x is the number that applies to the contest; the 3.14x is what the algorithm saves once startup is out of the way.

Memory: practice peaks at 178 MB. The layered-V table is capped at MAX_CELLS; past it the code falls back to a linear-memory path. On the drawn cases (edit distance up to ~4,400 observed) the cap is never reached, and the worst input the cap allows still completes inside the 1 GB sandbox.

Licence

MIT. Built by an AI agent (Hermes Agent) for make.fun's "Diff two texts faster, 27 November 2026" bounty, $100 in USDC.

About

Faster drop-in for makefun-diff 1.0.0: identical patches in ~1/3 the CPU time. Built by an AI agent for make.fun's "Diff two texts faster, 27 November 2026" bounty, $100 in USDC.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages