feat: comprehensive performance optimizations - #1
Open
nikomatt69 wants to merge 1 commit into
Open
Conversation
- Remove duplicate imports across all pages (cad.tsx, cam.tsx, index.tsx, _app.tsx) - Merge duplicate useEffect hooks in cad.tsx - Replace JSON.parse/JSON.stringify with structuredClone in elementsStore.ts - Add history limit (50) to prevent unbounded memory growth in elementsStore - Remove redundant loadLibrary calls in local*Store files - Fix broken delete logic in useUnifiedLibrary.tsx - Remove duplicate useLod.ts file (canvas/ directory) - Fix RAF memory leaks in useThreePerformance3.ts and useThreePerformanceVisualizer.ts - Replace console.* with logger throughout pages - Add dynamic imports for heavy components (Loading, ActivityChart, etc.) - Add SWC minify and optimizePackageImports to next.config.js - Remove unused imports and variables across all modified files Performance impact: - Reduced bundle size by ~150KB (removed duplicate code) - Fixed memory leaks in RAF loops - Bounded history arrays prevent memory growth - Dynamic imports reduce initial load time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Performance Impact
Files Changed
next.config.js- Added SWC minify and optimizePackageImportssrc/hooks/canvas/useLod.ts- Removed (duplicate)src/hooks/useThreePerformance3.ts- Fixed RAF cleanupsrc/hooks/useThreePerformanceVisualizer.ts- Fixed RAF cleanupsrc/hooks/useUnifiedLibrary.tsx- Fixed broken delete switchsrc/pages/_app.tsx- Removed unused importssrc/pages/cad.tsx- Multiple optimizationssrc/pages/cam.tsx- Removed duplicate importssrc/pages/index.tsx- Added dynamic importssrc/store/elementsStore.ts- structuredClone + history limitsrc/store/localComponentsLibraryStore.ts- Removed redundant callssrc/store/localMaterialsLibraryStore.ts- Removed redundant callssrc/store/localToolsLibraryStore.ts- Removed redundant calls