Skip to content

⚡ Bolt: Optimized PDF rendering loop#2

Open
MrAlokTech wants to merge 1 commit intomainfrom
bolt-render-optimization-15161736415482662905
Open

⚡ Bolt: Optimized PDF rendering loop#2
MrAlokTech wants to merge 1 commit intomainfrom
bolt-render-optimization-15161736415482662905

Conversation

@MrAlokTech
Copy link
Owner

⚡ Bolt: Optimized PDF rendering loop

💡 What:

  • Hoisted escapeHtml utility function to global scope.
  • Updated renderPDFs to calculate now and searchRegex (from searchInput.value) once per render cycle, instead of for every PDF card.
  • Updated createPDFCard to accept these pre-calculated values, removing redundant new Date() calls, document.getElementById queries, and new RegExp compilations.

🎯 Why:

  • The previous implementation accessed the DOM (document.getElementById) and created new RegExp and Date objects for every single card in the list during a search or render.
  • For a list of N items, this resulted in N DOM reads, 2N RegExp creations, and N Date object creations.
  • This optimization reduces this to 1 DOM read, 1 RegExp creation, and 1 Date object creation per render, significantly improving performance for large lists and smoother search filtering.

📊 Impact:

  • Reduces DOM access and object allocation overhead by factor of N (where N is number of PDFs).
  • Expected to make search input responsiveness snappier on lower-end devices.

🔬 Measurement:

  • Verified functionality using a Playwright script (verification_search.png) confirming that search highlighting and "NEW" badge logic remain correct.
  • Verified syntax with node -c script.js.

PR created automatically by Jules for task 15161736415482662905 started by @MrAlokTech

Moved escapeHtml to global scope.
Pre-calculated search regex and current date outside the render loop.
Updated createPDFCard to use pre-calculated values.

Co-authored-by: MrAlokTech <[email protected]>
@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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 11, 2026

Deploying classnotes with  Cloudflare Pages  Cloudflare Pages

Latest commit: 14dea8c
Status: ✅  Deploy successful!
Preview URL: https://b10b80d4.classnotes.pages.dev
Branch Preview URL: https://bolt-render-optimization-151.classnotes.pages.dev

View logs

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