Skip to content

perf: replace commander with cac#4284

Merged
chenjiahan merged 5 commits intomainfrom
use_cac_1227
Dec 28, 2024
Merged

perf: replace commander with cac#4284
chenjiahan merged 5 commits intomainfrom
use_cac_1227

Conversation

@chenjiahan
Copy link
Member

Summary

Replace commander with cac for performence.

https://github.com/cacjs/cac

Size

cac is 52kB smaller than commander.

  • cac:
  File (esm)      Size        
  dist/index.js    345.2 kB
  File (cjs)        Size        
  dist/index.cjs    367.4 kB
  • commander
  File (esm)      Size        
  dist/index.js    397.1 kB
  File (cjs)        Size        
  dist/index.cjs    419.3 kB

Startup time

cac is 5ms faster than commander.

  • cac
hyperfine --warmup 5 --runs 40 'node --run build'
Benchmark 1: node --run build
  Time (mean ± σ):     321.7 ms ±  11.7 ms    [User: 299.3 ms, System: 99.9 ms]
  Range (min … max):   293.5 ms … 370.5 ms    40 runs
  • commander
hyperfine --warmup 5 --runs 40 'node --run build'
Benchmark 1: node --run build
  Time (mean ± σ):     326.4 ms ±   7.7 ms    [User: 301.4 ms, System: 100.7 ms]
  Range (min … max):   307.5 ms … 354.6 ms    40 runs

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Dec 27, 2024

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 95f3c44
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/676eab008b3c7e0008ed472d
😎 Deploy Preview https://deploy-preview-4284--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 71 (🔴 down 2 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

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

@chenjiahan chenjiahan merged commit 472a54f into main Dec 28, 2024
9 checks passed
@chenjiahan chenjiahan deleted the use_cac_1227 branch December 28, 2024 00:43
@chenjiahan chenjiahan mentioned this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant