Skip to content

⚡ Bolt: Cache framework registry loading#511

Open
alinelena wants to merge 1 commit intomainfrom
bolt/cache-framework-registry-6177802362191715950
Open

⚡ Bolt: Cache framework registry loading#511
alinelena wants to merge 1 commit intomainfrom
bolt/cache-framework-registry-6177802362191715950

Conversation

@alinelena
Copy link
Copy Markdown
Collaborator

💡 What:
Memoized the reading and parsing of the frameworks.yml file in ml_peg/app/utils/utils.py. The private method _load_framework_registry now utilizes functools.lru_cache(maxsize=1). The public load_framework_registry method returns copy.deepcopy() of the cache to guarantee the global state cannot be mistakenly mutated.

🎯 Why:
The application calls get_framework_config (which in turn calls load_framework_registry) heavily during initial layout building and navigation. Parsing YAML is computationally expensive and disk I/O introduces latency. Repeatedly re-parsing a static frameworks.yml configuration represents a clear bottleneck.

📊 Impact:
Substantially decreases page load latency and application startup time by avoiding repetitive disk reads and Python YAML decoding for the framework configuration mapping.

🔬 Measurement:
We can benchmark the startup routine build_full_app and navigate between pages/frameworks in the UI. A timing trace or line profiler on get_framework_config() will show a dramatic reduction in wall time after the initial cache population.


PR created automatically by Jules for task 6177802362191715950 started by @alinelena

Memoize `_load_framework_registry` using `@lru_cache` and return a `deepcopy` from `load_framework_registry` to eliminate redundant disk I/O and YAML parsing.

Co-authored-by: alinelena <3306823+alinelena@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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