[PR #1028] [MERGED] perf(javascript): cache canonical export comparison sort keys #2592

Closed
opened 2026-10-17 21:07:58 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1028
Author: @morluto
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @morluto

Base: main ← Head: perf/javascript-export-sort-keys


📝 Commits (1)

  • 4e69863 perf(javascript): cache canonical export comparison sort keys

📊 Changes

4 files changed (+58 additions, -31 deletions)

View changed files

📝 src/domain/javascript/javascriptExportShapeComparison.ts (+38 -11)
📝 src/domain/javascript/javascriptExportShapeVariants.ts (+0 -19)
📝 tests/acceptance/applications/applicationExportShapeMcp.test.ts (+5 -1)
📝 tests/boundary/filesystem/javascriptExportShapeComparison.test.ts (+15 -0)

📄 Description

Large JavaScript export comparisons repeatedly canonicalize both changes on every sort comparison. Cache the exact existing canonical key once per change and retain stable tie ordering, complete output, and comparison identities.

The large-inventory acceptance fixture also stops analyzing an identical extra-export inventory twice. It still checks 1,001 candidates, 33 paired variants with 64 fields each, and a separate source-produced comparison with 10,001 changed fields. This addresses the 30-second timeout seen in the Linux merge CI for #1011.

On this macOS host, an actual 10,001-change comparison took 1,191 ms before and 686 ms after (about 42% lower elapsed time). The complete 6,249,742-character serialized result was byte-for-byte identical using the same source-produced Evidence inputs. These are local measurements, not a cross-platform speed guarantee.

Validation:

  • npm run build:cached, npm run check:ci, and npm run docs:check passed.
  • Single-worker export-comparison boundary and application/MCP acceptance tests: 21 passed; the large-inventory case completed in 2.9 seconds locally.
  • Independent source review found no remaining blocking findings.
  • Linux merge CI in #1011 passed all four test shards. The previously timing-out inventory case completed in 15.5 seconds (previous failure took roughly 35 seconds against its 30-second limit).
  • Real Hopper/Ghidra verification was not performed; this change concerns pure JavaScript comparison and its deterministic fixtures.

Related to #893.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1028 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `perf/javascript-export-sort-keys` --- ### 📝 Commits (1) - [`4e69863`](https://github.com/morluto/rea/commit/4e69863140a40ca0931875fcd4f2766106d1407f) perf(javascript): cache canonical export comparison sort keys ### 📊 Changes **4 files changed** (+58 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptExportShapeComparison.ts` (+38 -11) 📝 `src/domain/javascript/javascriptExportShapeVariants.ts` (+0 -19) 📝 `tests/acceptance/applications/applicationExportShapeMcp.test.ts` (+5 -1) 📝 `tests/boundary/filesystem/javascriptExportShapeComparison.test.ts` (+15 -0) </details> ### 📄 Description Large JavaScript export comparisons repeatedly canonicalize both changes on every sort comparison. Cache the exact existing canonical key once per change and retain stable tie ordering, complete output, and comparison identities. The large-inventory acceptance fixture also stops analyzing an identical extra-export inventory twice. It still checks 1,001 candidates, 33 paired variants with 64 fields each, and a separate source-produced comparison with 10,001 changed fields. This addresses the 30-second timeout seen in the Linux merge CI for #1011. On this macOS host, an actual 10,001-change comparison took 1,191 ms before and 686 ms after (about 42% lower elapsed time). The complete 6,249,742-character serialized result was byte-for-byte identical using the same source-produced Evidence inputs. These are local measurements, not a cross-platform speed guarantee. Validation: - `npm run build:cached`, `npm run check:ci`, and `npm run docs:check` passed. - Single-worker export-comparison boundary and application/MCP acceptance tests: 21 passed; the large-inventory case completed in 2.9 seconds locally. - Independent source review found no remaining blocking findings. - Linux merge CI in #1011 passed all four test shards. The previously timing-out inventory case completed in 15.5 seconds (previous failure took roughly 35 seconds against its 30-second limit). - Real Hopper/Ghidra verification was not performed; this change concerns pure JavaScript comparison and its deterministic fixtures. Related to #893. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:07:58 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2592
No description provided.