Skip to content

⚡ Bolt: Lazy load exercises and notebooks#376

Merged
saint2706 merged 1 commit intomainfrom
perf/lazy-load-content-9427291637281753950
Feb 14, 2026
Merged

⚡ Bolt: Lazy load exercises and notebooks#376
saint2706 merged 1 commit intomainfrom
perf/lazy-load-content-9427291637281753950

Conversation

@saint2706
Copy link
Owner

💡 What: Refactored src/utils/contentLoader.ts to lazy load allExercises and notebooks. These large data structures are now computed on first access (via getAllExercises and getAllNotebooks) rather than eagerly on module import.

🎯 Why: Eager parsing of 100+ markdown files (via regex) and solution notebooks (via JSON.parse) was blocking the main thread during application startup.

📊 Impact: Deferred ~8-10ms of parsing work (in test environment) from the critical startup path. This scales with the number of lessons and complexity of content, ensuring faster Time to Interactive.

🔬 Measurement: Verified with a benchmark script that showed import time no longer triggers the parsing logic.


PR created automatically by Jules for task 9427291637281753950 started by @saint2706

Deferred the parsing of exercises and solution notebooks until they are actually accessed. This prevents blocking the main thread during initial application load with regex and JSON parsing operations for 100+ lessons.

Co-authored-by: saint2706 <45678566+saint2706@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 14, 2026 04:23
@google-labs-jules
Copy link
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.

Copy link
Contributor

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 reduces application startup work by deferring expensive exercise extraction and notebook JSON parsing in src/utils/contentLoader.ts until the data is actually requested by the UI.

Changes:

  • Lazily compute and freeze the exercises collection on first getAllExercises() call instead of at module import.
  • Lazily compute and freeze the notebooks collection on first getAllNotebooks() call, and route getNotebook() through the lazy accessor.
  • Document the performance learning/action in .Jules/bolt.md.

Reviewed changes

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

File Description
src/utils/contentLoader.ts Replaces eager module-scope parsing with cached lazy initialization for exercises and notebooks.
.Jules/bolt.md Adds an entry documenting the eager parsing cost and the lazy-load refactor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@saint2706 saint2706 merged commit 52e9477 into main Feb 14, 2026
7 checks passed
@saint2706 saint2706 deleted the perf/lazy-load-content-9427291637281753950 branch February 14, 2026 11:23
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

Comments