java-topology/whitepaper
russell@unturf.com a150602100
wave6 follow-up: gatsby-0001 — three filter-cache builders nodeTypeNames.includes -> Set
The Gatsby authors annotated each of the three call sites in
in-memory/indexing.ts with 'expensive at scale' comments. Their
diagnosis is correct: nodeTypeNames.includes(node.internal.type)
inside iterateNodes().forEach is O(N*T) per cache build.

For N=100k+ nodes typical of mature content sites and T=10-30
declared types per query, this fires on every type-filtered query.
gatsby develop in particular rebuilds caches per page render.

Fix: hoist Set<string> once at the top of each function. O(1) per
node lookup. Total cost O(N+T). Bench shows 8.4x at N=100k T=50;
2.7-4.7x at smaller scales.

Three call sites patched: ensureIndexByElemMatch (line 326),
ensureEmptyFilterCache (378), ensureIndexByElemMatchValue (504).
Author 'expensive at scale' comments updated to record the fix.
2026-04-25 10:15:32 -04:00
..
disclosure undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
fonts undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
gumyum disclosure: add security@undefect.com contact to whitepaper §16 and gumyum minecraft page 2026-03-27 10:57:50 -04:00
outreach wave6 follow-up: gatsby-0001 — three filter-cache builders nodeTypeNames.includes -> Set 2026-04-25 10:15:32 -04:00
proof undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
vectors undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
abstract.rst undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
conf.py undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
executive-summary.md undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
executive-summary.pdf undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
full-paper.md fix: remove 'The' from fixed system harmony sentence 2026-04-10 12:40:37 -04:00
full-paper.pdf undefect. CWE-407 — 92 sites, 42 ecosystems 2026-03-26 19:48:18 -04:00
index.rst undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
Makefile whitepaper: add html-cwe407 and html-minecraft targets; update clean 2026-03-27 19:52:27 -04:00
MD5SUMS whitepaper: onos-0004 entry, count 615→616, rebuild PDF 2026-03-28 10:56:56 -04:00
outreach.tar.gz undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
pdf-style.css undefect. CWE-407 — 92 sites, 42 ecosystems 2026-03-26 19:48:18 -04:00
undefect-cwe407-2026-03-24.pdf undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
undefect-cwe407-2026-03-25.pdf undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
undefect-cwe407-2026-03-26.pdf undefect. CWE-407 — 92 sites, 42 ecosystems 2026-03-26 19:48:18 -04:00
undefect-cwe407-2026-03-27.pdf godot-0005..0008 whitepaper entries + UNDF stamps; A* open_list.find O(N) 800x, skeleton child_bones 24x, RestFixer 188x, GLTF extensions 11x; count 611→615 2026-03-27 23:18:59 -04:00
undefect-minecraft-enterprise-java-2026-03-24.pdf undefect. CWE-407 — 92 sites, 42 ecosystems 2026-03-26 19:48:18 -04:00
undefect-minecraft-enterprise-java-2026-03-25.pdf undefect. CWE-407 — 63 sites patched across 27 ecosystems 2026-03-26 17:11:57 -04:00
undefect-minecraft-enterprise-java-2026-03-26.pdf undefect. CWE-407 — 92 sites, 42 ecosystems 2026-03-26 19:48:18 -04:00
undefect-minecraft-enterprise-java-2026-03-27.pdf disclosure: add security@undefect.com contact to whitepaper §16 and gumyum minecraft page 2026-03-27 10:57:50 -04:00