8000 Experimental speed enhancements by Zorlin · Pull Request #67 · riffcc/flagship · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Experimental speed enhancements #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 24, 2025
Merged

Conversation

Zorlin
Copy link
Contributor
@Zorlin Zorlin commented May 24, 2025

Via Claude Code.

Great! The optimizations have significantly improved the bundle. The main index file went from 3.5MB to 117KB! Here's a summary of what was achieved:

  Bundle Size Improvements

  Before optimization:
  - Main bundle: 3,531.79 kB (3.5MB)

  After optimization:
  - Main bundle: 117.24 kB (88% reduction!)
  - Code is now split into multiple chunks
  - Lazy loading implemented for routes and heavy components

  Key Optimizations Implemented:

  1. Route-based code splitting: All routes except HomePage are now lazy loaded
  2. Manual chunking: Dependencies are split into logical chunks:
    - Vue core libraries
    - Vuetify UI framework
    - PeerBit/P2P libraries
    - SQLite database
    - Other vendor dependencies
  3. Component lazy loading:
    - Audio and video players load on demand
    - Featured slider loads asynchronously
  4. Build optimizations:
    - Terser minification enabled
    - Console logs removed in production
    - Source maps maintained for debugging
  5. HTML optimizations:
    - Preconnect hints for external resources
    - Font preloading for critical resources

  The largest remaining chunks (>500KB) are:
  - chunk-U59bhg-D.js (629KB) - Likely P2P/crypto libraries
  - chunk-nCzzmfih.js (1.27MB) - Likely the lens-sdk with all PeerBit dependencies

  These could be further optimized by lazy loading the P2P initialization until after the initial page load.

@Zorlin
Copy link
Contributor Author
Zorlin commented May 24, 2025
Great! The build is successful and the main bundle is now only 52KB (down from 3.5MB). The code is properly split into logical chunks.

  The optimizations have successfully:
  1. Reduced the main bundle from 3.5MB to 52KB (98.5% reduction)
  2. Split code into logical chunks that load on demand
  3. Avoided circular dependencies by using a smarter chunking strategy
  4. Maintained lazy loading for routes

  The deployment should now work without the initialization error. The largest chunks (>500KB) contain heavy dependencies like P2P libraries and the lens-sdk, which will only load when
   needed.

@Zorlin Zorlin requested a review from Copilot May 24, 2025 16:46
Copy link
@Copilot 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 implements experimental speed enhancements that significantly reduce the bundle size and improve load performance. Key changes include:

  • Lazy loading of non-critical routes and components.
  • Manual chunking and build optimizations in the Vite configuration.
  • Addition of preconnect and preload hints in the HTML for faster resource loading.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/renderer/vite.config.js Updated build config with manual chunking, conditional sourcemaps, and Terser minification settings.
packages/renderer/src/plugins/router.ts Converted route components to lazy loaded functions to optimize performance.
packages/renderer/src/App.vue Adjusted component import ordering for audio and video players.
packages/renderer/indexBrowser.html Added preconnect and preload tags to optimize external resource loading.
Comments suppressed due to low confidence (1)

packages/renderer/vite.config.js:84

  • [nitpick] Consider renaming the variable 'dépendsÀExclure' to use ASCII characters for consistency and to avoid potential issues in toolchains.
external: dépendsÀExclure,

Comment on lines 123 to 124
const facadeModuleId = chunkInfo.facadeModuleId ? chunkInfo.facadeModuleId.split('/').pop() : 'chunk';
return `${facadeModuleId}-[hash].js`;
Copy link
Preview
Copilot AI May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The generated chunk file names may collide if multiple modules have the same base name; consider incorporating additional identifiers to ensure uniqueness.

Suggested change
const facadeModuleId = chunkInfo.facadeModuleId ? chunkInfo.facadeModuleId.split('/').pop() : 'chunk';
return `${facadeModuleId}-[hash].js`;
const facadeModuleId = chunkInfo.facadeModuleId || 'chunk';
const baseName = facadeModuleId.split('/').pop();
const dirName = facadeModuleId.split('/').slice(-2, -1)[0] || 'unknown';
const sanitizedDirName = dirName.replace(/[^a-zA-Z0-9_-]/g, '');
return `${sanitizedDirName}-${baseName}-[hash].js`;

Copilot uses AI. Check for mistakes.

@Zorlin Zorlin merged commit 617dfde into zorlin/peerbit-rewrite May 24, 2025
3 of 10 checks passed
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
0