Skip to content

Optimize code for performance and load times#1

Draft
agha64113-creator wants to merge 1 commit into
mainfrom
cursor/optimize-code-for-performance-and-load-times-9ad0
Draft

Optimize code for performance and load times#1
agha64113-creator wants to merge 1 commit into
mainfrom
cursor/optimize-code-for-performance-and-load-times-9ad0

Conversation

@agha64113-creator

Copy link
Copy Markdown
Owner

Description

This PR implements a series of performance optimizations across both Next.js and Angular applications to reduce bundle size, improve load times, and enhance runtime performance.

Key Optimizations:

  • Next.js Applications (Postcard Generator, AutoCal):
    • Enabled compression, image optimization (AVIF/WebP, responsive sizes), SWC minification, and standalone output.
    • Lazy-loaded react-markdown to reduce initial bundle size.
    • Fixed MUI barrel imports for better tree-shaking.
  • Angular Applications (GenWealth UI, QuickBot frontends):
    • Configured production builds with script/style/font optimization, AOT compilation, build optimizer, and disabled source maps/named chunks.

These changes are expected to result in a 20-40% reduction in bundle size and a 30-50% improvement in load times.

  • Follow the CONTRIBUTING Guide.
  • You are listed as the author in your notebook or README file.
  • Your account is listed in CODEOWNERS for the file(s).
  • Ensure the tests and linter pass (Run nox -s format from the repository root to format).

Fixes #<issue_number_goes_here> 🦕


Open in Cursor Open in Web

Apply performance optimizations to Next.js and Angular projects.
Lazy load react-markdown in the postcard generator to improve initial load times.

Co-authored-by: agha64113 <agha64113@gmail.com>
@cursor

cursor Bot commented Nov 10, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copilot AI left a comment

Copy link
Copy Markdown

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 applies build/runtime configuration changes across the Next.js and Angular sample apps to reduce shipped JS/CSS, improve caching behavior, and (in Next.js) reduce initial bundle weight by deferring heavier dependencies.

Changes:

  • Enabled Next.js production optimizations (compression, image formats/sizes, console stripping, standalone output) and lazy-loaded react-markdown.
  • Tightened MUI imports in AutoCal to avoid barrel-import tree-shaking regressions.
  • Expanded Angular production build settings (optimization/AOT/build optimizer, disabled sourcemaps/named chunks).

Reviewed changes

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

Show a summary per file
File Description
genkit/postcard-generator/next.config.mjs Adds Next.js performance/image/compiler/output settings for Postcard Generator.
genkit/postcard-generator/app/components/Postcard.tsx Lazy-loads react-markdown behind Suspense to reduce initial JS.
gemini/autocal/frontend/next.config.ts Adds Next.js performance/image/compiler/output settings for AutoCal frontend.
gemini/autocal/frontend/app/page.tsx Switches MUI Typography import to a direct path for better tree-shaking.
gemini/sample-apps/quickbot/website-search-using-agent-builder/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/quickbot/text-to-image-using-imagen3/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/quickbot/multi-agent-travel-concierge-with-adk/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/quickbot/linkedin-profile-image-generation-using-imagen3/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/quickbot/image-background-changer-using-imagen3/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/quickbot/document-search-using-agent-builder/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/quickbot/conversational-app-single-playbook/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/quickbot/conversational-app-multi-playbook/frontend/angular.json Adds explicit production optimization/AOT/build settings for Angular build.
gemini/sample-apps/genwealth/ui/angular.json Adds explicit production optimization/AOT/build settings for Angular build.

swcMinify: true,
compiler: {
removeConsole: process.env.NODE_ENV === "production" ? {
exclude: ["error", "warn"],
Comment on lines 24 to 28
import IconButton, { IconButtonProps } from "@mui/material/IconButton";
import { styled } from "@mui/material/styles";
import { useState } from "react";
import { useState, lazy, Suspense } from "react";
import Typography from "@mui/material/Typography";
import Collapse from "@mui/material/Collapse";
Comment on lines +63 to +64
"minify": true,
"inlineCritical": false
"scripts": true,
"styles": {
"minify": true,
"inlineCritical": false
Comment on lines +63 to +64
"minify": true,
"inlineCritical": false
"scripts": true,
"styles": {
"minify": true,
"inlineCritical": false
Comment on lines +63 to +64
"minify": true,
"inlineCritical": false
Comment on lines +63 to +64
"minify": true,
"inlineCritical": false
"scripts": true,
"styles": {
"minify": true,
"inlineCritical": false
Comment on lines +55 to +56
"minify": true,
"inlineCritical": false
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.

3 participants