web-infra-dev / rsdoctor

A one-stop build analyzer for Rspack and webpack.
https://rsdoctor.dev/
MIT License
424 stars 33 forks source link

perf: optimize the package graph algorithm #412

Closed easy1090 closed 3 months ago

easy1090 commented 3 months ago

Summary

perf: optimize the package graph algorithm.

In some repositories, a large amount of time is spent on the createPackageGraph function. It is because the path.relative api. So optimize the algorithm of contain function. After optimization, the createPackageGraph function has a 75% improvement in time efficiency.

this.root and file are absolute path, so no need relative to check.

Before: img_v3_02ce_685513b2-a168-4e76-8b80-944b10e92f6g

image

After: img_v3_02cf_948edf00-92e3-413d-a7e5-8fe7d3383a4g

image

Related Links

closes: #414

netlify[bot] commented 3 months ago

Deploy Preview for rsdoctor ready!

Name Link
Latest commit d39a4d241530e2ac3a7761bf873f4c6fc1c24222
Latest deploy log https://app.netlify.com/sites/rsdoctor/deploys/6686181a2d81bb0008df41fc
Deploy Preview https://deploy-preview-412--rsdoctor.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 site configuration.