Skip to content

Add parsed module caching with tests#347

Merged
nlothian merged 2 commits intomainfrom
codex/implement-module-parsing-cache
Dec 13, 2025
Merged

Add parsed module caching with tests#347
nlothian merged 2 commits intomainfrom
codex/implement-module-parsing-cache

Conversation

@nlothian
Copy link
Copy Markdown
Owner

Summary

  • add a per-interpreter parsed-module cache keyed by file path, parser configuration, and mtime to reuse parsed directives and clauses
  • bump operator table versioning and parser invocation hooks to support cache invalidation and testing
  • document the cache and add coverage for reuse, nested imports, and mtime-driven invalidation

Testing

  • uv run pytest tests/test_module_parsing_cache.py

Codex Task

Copy link
Copy Markdown

@kilo-code-bot kilo-code-bot Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No Issues Found

5 files reviewed | Confidence: 95% | Recommendation: Merge

Review Details

Files: docs/FEATURES.md, docs/SYNTAX_NOTES.md, tests/test_module_parsing_cache.py, vibeprolog/interpreter.py, vibeprolog/operators.py

Checked: Security, correctness, performance, error handling, cache invalidation logic

Summary: The PR adds parsed module caching to improve performance by avoiding redundant parsing of unchanged files. The implementation correctly invalidates cache on file modification time changes, operator table changes, character conversion changes, and conditional compilation state changes. Tests cover reuse across imports and invalidation on mtime changes. No security or correctness issues found.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a valuable performance improvement by adding a parsed module cache, which will significantly speed up repeated consultations of the same files. The implementation is well-structured, and the inclusion of tests for cache hits and mtime-based invalidation is excellent. I have a few suggestions to improve test performance, optimize the caching logic, and enhance code readability.

Comment thread tests/test_module_parsing_cache.py Outdated
Comment thread vibeprolog/interpreter.py Outdated
Comment thread vibeprolog/operators.py
@nlothian
Copy link
Copy Markdown
Owner Author

/gemini review

@nlothian nlothian added the nac Nick's Autocoder used: https://github.com/nlothian/autocoder label Dec 13, 2025
…d ensure version bump only on actual changes; apply consistent changed = changed or (previous != info) logic for table and module_operators and removals
@nlothian nlothian merged commit 2d1f5a7 into main Dec 13, 2025
2 checks passed
@nlothian nlothian deleted the codex/implement-module-parsing-cache branch December 13, 2025 04:35
@nlothian nlothian linked an issue Dec 13, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex nac Nick's Autocoder used: https://github.com/nlothian/autocoder

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache parsed modules to avoid redundant Earley parsing

1 participant