Conversation
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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What:
Memoized the reading and parsing of the
frameworks.ymlfile inml_peg/app/utils/utils.py. The private method_load_framework_registrynow utilizesfunctools.lru_cache(maxsize=1). The publicload_framework_registrymethod returnscopy.deepcopy()of the cache to guarantee the global state cannot be mistakenly mutated.🎯 Why:
The application calls
get_framework_config(which in turn callsload_framework_registry) heavily during initial layout building and navigation. Parsing YAML is computationally expensive and disk I/O introduces latency. Repeatedly re-parsing a staticframeworks.ymlconfiguration 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_appand navigate between pages/frameworks in the UI. A timing trace or line profiler onget_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