Skip to content

perf: Cache size of 3 graphs causes thrashing on SWE-BENCH #34

@greynewell

Description

@greynewell

Problem

The cache in src/cache/graph-cache.ts:294 only holds 3 graphs:

this.maxGraphs = options?.maxGraphs || 3;  // Only 3 graphs!

SWE-BENCH agents typically analyze multiple directories or switch between subsystems, causing constant cache eviction.

Example Failure Scenario

1. Analyze django/core          → Cache: [core]
2. Analyze django/contrib       → Cache: [core, contrib]  
3. Analyze django/db            → Cache: [core, contrib, db]
4. Back to django/core (edit)   → Cache: [contrib, db, core] (evicted!)
5. Check django/contrib again   → CACHE MISS! Re-fetch everything

Impact on SWE-BENCH

  • 30-50% increased latency from cache misses
  • Repeated API calls and re-zipping
  • Higher costs
  • Agents may abandon tool due to slowness

Proposed Fix

this.maxGraphs = options?.maxGraphs || 20;  // At least 20
this.maxNodes = options?.maxNodes || 1000000;  // 1M nodes

Most SWE-BENCH repos have 10k-50k nodes, so 20 graphs = plenty of headroom.

Priority

🟠 HIGH - Significant performance impact on benchmark

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions