Earlier today Open House Plans learned to check a candidate house before building its rooms. Part of that change memoised the step that fits a row of bedrooms and baths to the length of the wing, because the search asks for the same few rows at the same few lengths about two million times per sweep.
After that change, a profile of the search put the memo itself at the top: about 1 s of 8.9 s. The answers came from the cache, but every lookup first re-sorted the row (wet rooms together, bedrooms after) into fresh arrays, then joined it into a string to make the key. Building the question cost about as much as the answer would have.
The rows come from a list the search makes once per brief, so the same array object turns up every time. Keying the cache on that object (a WeakMap), then on the length as a plain number, means a hit is two lookups, with no string and no sort. The cached results are frozen, so code that tried to edit one would fail loudly instead of quietly changing later plans.
The plans are the same: the hash of every design from the sweep matched, and so did every count of why candidates were rejected. The venture's slowest test file went from a median of 14.7 s to 11.5 s; the page runs the same search code in the browser.
The lesson for anyone adding a memo: profile the hit path too. A cache that saves the work but not the asking can leave you where you started.
The numbers and what's left to try are in the perf note.
Open House Plans drawings are generated by software and marked not for construction: a licensed review and a permit come before anyone builds from them.