Skip to content

add lru to the parser in python#201

Merged
evinism merged 1 commit intomainfrom
es/lru_parse_python
Sep 24, 2025
Merged

add lru to the parser in python#201
evinism merged 1 commit intomainfrom
es/lru_parse_python

Conversation

@evinism
Copy link
Copy Markdown
Owner

@evinism evinism commented Sep 23, 2025

From the discord

@evinism evinism requested a review from Copilot September 23, 2025 06:29
@netlify
Copy link
Copy Markdown

netlify Bot commented Sep 23, 2025

Deploy Preview for mistql canceled.

Name Link
🔨 Latest commit 83a6f24
🔍 Latest deploy log https://app.netlify.com/projects/mistql/deploys/68d2470f50eea9000877cf3a

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds LRU caching functionality to the MistQL parser in Python to improve performance for repeated queries. The cache stores parsed ASTs for queries to avoid re-parsing the same query string multiple times.

  • Added parse_lru_cache_size parameter to MistQLInstance constructor with default size of 1
  • Replaced direct parse() calls with cached version using functools.lru_cache
  • Added comprehensive test suite covering basic functionality, size limits, performance, statistics, and edge cases

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
py/mistql/instance.py Added LRU cache integration with configurable cache size and cached parse method
py/tests/test_lru_cache.py Comprehensive test suite for LRU cache functionality including performance, statistics, and edge cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread py/mistql/instance.py Outdated
Comment thread py/tests/test_lru_cache.py
@evinism evinism force-pushed the es/lru_parse_python branch from 793c8c5 to 0074858 Compare September 23, 2025 07:02
@evinism evinism requested a review from Copilot September 23, 2025 07:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread py/tests/test_lru_cache.py Outdated
@evinism evinism force-pushed the es/lru_parse_python branch from 0074858 to 83a6f24 Compare September 23, 2025 07:06
@evinism
Copy link
Copy Markdown
Owner Author

evinism commented Sep 24, 2025

Gonna go ahead and merge this.

@evinism evinism merged commit 98268db into main Sep 24, 2025
37 checks 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.

2 participants