Skip to content

perf: 47% faster JSON parse + graph build via AutoResearch#81

Merged
jcfischer merged 10 commits intomainfrom
autoresearch/parse-perf-mar16
Mar 16, 2026
Merged

perf: 47% faster JSON parse + graph build via AutoResearch#81
jcfischer merged 10 commits intomainfrom
autoresearch/parse-perf-mar16

Conversation

@jcfischer
Copy link
Copy Markdown
Owner

Summary

  • 47.6% performance improvement on JSON parse + graph build (5,338ms → 2,797ms on 360MB / 1.68M node real Tana export)
  • Ran 7 AutoResearch rounds (Karpathy-style autonomous optimization): 5 kept, 2 discarded
  • All 29 parser/graph/indexer tests pass, identical output (same node/supertag/field/tag_application counts)

Key Changes

  • Replace Zod per-node validation with fast structural check — Zod was 75% of parse time, validating 1.68M nodes against schema. Top-level structural check + type assertion instead.
  • Single-pass graph build — merged 4 separate full iterations over docs into one, reducing from 5 passes to 2 (index build + classification)
  • Single iteration with deferred resolution — further merged to 1 pass over docs + tiny candidate resolution pass (~1% of nodes)
  • Remove unused defaults loopinbound_refs, outbound_refs, editMode defaults were set on every node but never consumed
  • Use Bun.file().json() — avoids intermediate string allocation

AutoResearch Results (results.tsv)

Commit Total Status Description
af02f5e 5338.8ms ✓ keep baseline
93fec81 3148.1ms ✓ keep single-pass graph build
d205f3a 2982.8ms ✓ keep remove defaults loop
d324b26 3121.9ms ✗ discard early exit SYS scan
da26963 3195.1ms ✗ discard trashIds Set
77d485f 2999.4ms ✓ keep Bun.file().json()
9e5706d 2797.3ms ✓ keep single iteration + deferred

Test plan

  • 29 parser/graph/field-values tests pass on every round
  • Output identical: 582 supertags, 1243 fields, 12121 tag applications
  • Benchmarked on real 360MB export (1,679,904 nodes)
  • Verify supertag sync works end-to-end with real workspace

🤖 Generated with Claude Code

@jcfischer jcfischer merged commit 73c84a6 into main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant