Skip to content

perf: Analytics Phase 6 — Optimization & Cleanup (107MB RAM saved) - #31

Closed
ChitkulLakshya wants to merge 3 commits into
mainfrom
feature/analytics-phase6
Closed

perf: Analytics Phase 6 — Optimization & Cleanup (107MB RAM saved)#31
ChitkulLakshya wants to merge 3 commits into
mainfrom
feature/analytics-phase6

Conversation

@ChitkulLakshya

Copy link
Copy Markdown
Collaborator

Analytics Phase 6 — Optimization & Cleanup

Optimizes server for Render 512MB plan. Reduces startup RAM by 107MB (49%).

Memory Impact

Metric Before After Saved
RSS 220MB 113MB -107MB (49%)
Heap Used 101MB 30MB -71MB (70%)
Heap Total 212MB 61MB -151MB (71%)

Changes

  1. Lazy-load googleapis (emailService.js) - saves 62MB heap at startup
  2. Remove dead User model with firebaseUid from deletion endpoints
  3. Code-split AnalyticsPage as lazy route in App.jsx
  4. Add GET /api/health endpoint for Render monitoring

Build

  • Vite build: PASS (2.24s)
  • No new dependencies

Docs

  • docs/analytics/phase6-optimization-and-cleanup.md

… endpoint

RAM optimizations for 512MB Render plan:
- emailService.js: lazy-load googleapis via getOAuth2Client() instead of
  top-level require. Saves ~55MB heap at startup (googleapis 62MB → 0MB
  until first email send)
- index.js: remove dead User model (firebaseUid) from both account
  deletion endpoints. User model was leftover from Firebase migration
  (PR #12), departments now stored in Supabase profiles table
- index.js: add GET /api/health endpoint returning RSS, heap, external
  memory + uptime for Render monitoring
- Move AnalyticsPage from static import to lazy() import
- Creates separate chunk: AnalyticsPage-*.js (21.7KB)
- Reduces main bundle by ~23KB (5,950KB → 5,927KB)
- Analytics page only loads when user navigates to it
Copilot AI lite review requested due to automatic review settings August 14, 2026 18:26

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for leddger-ai ready!

Name Link
🔨 Latest commit da9d3ff
🔍 Latest deploy log https://app.netlify.com/projects/leddger-ai/deploys/6a7f5dba7c3369000849b95c
😎 Deploy Preview https://deploy-preview-31--leddger-ai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ChitkulLakshya

Copy link
Copy Markdown
Collaborator Author

Closing as stale — this branch is significantly behind main and merging it would revert 6000+ lines of merged work including Google Drive integration, connection maps, RAM optimizations, OTP verification, and multiple bug fixes. Please rebase on latest main if you need any of these changes.

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.

2 participants