Skip to content

Enhancement: Implement AST/parsing cache to optimize performance on large repositories #1288

Open

Description

@Neelr1912

Is your feature request related to a problem? Please describe.

When running CodeGraphContext frequently during active development on a large codebase, the tool recalculates the entire context graph from scratch. Parsing the Abstract Syntax Trees (ASTs) or traversing all files repeatedly creates an unnecessary bottleneck and slows down the developer feedback loop.

Describe the solution you'd like

Introduce a caching mechanism (e.g., storing a .codegraph-cache file in the repository root or system temp directory). The tool should check file modification timestamps or hashes before parsing; if a file hasn't changed, it should load its context from the cache rather than re-parsing it.

Describe alternatives you've considered

Running the tool only on specific sub-directories, but this loses the global context of the codebase.

Additional context

A command-line flag like --clear-cache or --no-cache should be included to allow users to force a fresh run when needed.

Activity

  1. Neelr1912 commented on Jun 19, 2026

    @Neelr1912
    Author

    /assign gssoc

  2. github-actions commented on Jun 19, 2026

    @github-actions
    Contributor

    Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

  3. valkyrie-nyx commented on Jun 19, 2026

    @valkyrie-nyx

    Hi ,

    I'd love to work on this feature under GSSoC.

    Frequent full re-parsing can noticeably slow down the development workflow, especially for larger codebases, so adding a caching layer would be a valuable improvement.

    My plan is to introduce a cache that stores parsed file context and uses file timestamps or hashes to determine which files actually need to be reprocessed. I'll also add options like --clear-cache and --no-cache so users can easily control the caching behavior when needed.

    I'll make sure cache invalidation is handled properly and that the global context graph stays accurate across runs.

    Please assign this issue to me. Thanks!

  4. codematser69 commented on Jun 20, 2026

    @codematser69

    Hello Maintainers,

    I would like to work on this issue as part of GSSoC and would appreciate being assigned to it.

    Understanding of the Problem

    Currently, the tool reparses files and rebuilds the AST graph from scratch on every execution. In large repositories, this creates unnecessary overhead because most files remain unchanged between runs, resulting in longer processing times and a slower developer feedback loop.

    Proposed Solution

    I plan to implement an AST/parsing cache mechanism that stores parsed results along with file metadata, such as modification timestamps or content hashes.

    The implementation will follow these steps:

    1. Create a cache file to persist parsed AST data and associated metadata.
    2. Compare the current file state against cached metadata during subsequent runs.
    3. Reuse cached ASTs for unchanged files.
    4. Reparse only modified or newly added files.
    5. Remove stale cache entries corresponding to deleted files.
    6. Add cache invalidation support (e.g., "--clear-cache" or "--no-cache") to allow users to force a fresh rebuild when needed.

    Expected Impact

    • Faster execution on large repositories.
    • Reduced redundant parsing operations.
    • Improved scalability and performance.
    • Better developer experience through shorter feedback cycles.

    I have reviewed the issue and believe this enhancement would be a valuable contribution to the project. I would be excited to work on it as a GSSoC contribution and collaborate with the maintainers to ensure a robust implementation.

    Thank you for your consideration.

  5. added
    gssoc:approvedGSSoC validation: counts toward scoring
    level:advancedGSSoC difficulty: 55 pts contributor / 30 mentor
    mentor:Shashankss1205GSSoC mentor attribution: credits reviewing mentor
    type:featureGSSoC type bonus: feature
    on Sep 24, 2026
  6. Shashankss1205 commented on Oct 15, 2026

    @Shashankss1205
    Collaborator

    Maintenance review — 15 October 2026

    Keep caching keyed by file content plus parser/grammar/config versions, with bounded storage and delete/rename invalidation. Full-vs-cached graph equivalence is required; draft #1052's parallel parsing is a separate optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

gssoc:approvedGSSoC validation: counts toward scoringlevel:advancedGSSoC difficulty: 55 pts contributor / 30 mentormentor:Shashankss1205GSSoC mentor attribution: credits reviewing mentortype:featureGSSoC type bonus: feature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions