Skip to content
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

fix: log stats in debug mode #614

Merged
merged 8 commits into from
Apr 10, 2023
Merged

fix: log stats in debug mode #614

merged 8 commits into from
Apr 10, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Apr 7, 2023

Log client/server compile stats in debug mode instead of info. This has been bugging me for a while since it shows up in debug and CI logs by default, making debugging hard 😅

IIUC it's shown so that users understand what's taking so long to compile/prebundle. I checked Vite 4.3 with prebundling, and it only had a 1.5s improvement (10.5s in Vite 4.3). The bottleneck seems to still be in the Svelte compiler according to the cpuprofile.

@dominikg
Copy link
Member

dominikg commented Apr 8, 2023

hmm, you can disable the compile stats in dev/build or completely. The purpose of the info log was mostly to make this information accessible to regular users as debug is very noisy.

Even with vite's recent enhancements to performance tracking, it would be hard to get information aggregated by svelte dependency out of it.

But I did not receive any feedback from the logged stats, so if you think this is detrimental to do by default, maybe instead of moving it do debug level, we should just switch the default value of the config flag to true (or rather rename it to enableCompileStats)?

https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#disablecompilestats

@bluwy
Copy link
Member Author

bluwy commented Apr 9, 2023

Maybe we can expose the stats under a specific namespace like vite:vite-plugin-svelte:stats? Then we can have someone run with DEBUG="vite:vite-plugin-svelte:stats" to achieve the same result.

I'm not sure about showing the stats by default since it isn't always useful for user's projects, as it's only helpful for large Svelte deps, or large Svelte SSR files. Even then with the info presented, the user might not be looking into fixing it just yet. If they have to enable DEBUG= manually, it likely means they're willing to take time to optimize things.

@bluwy
Copy link
Member Author

bluwy commented Apr 9, 2023

Updated to use a namespace:

Forced re-optimization of dependencies

  VITE v4.2.1  ready in 455 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
  vite:vite-plugin-svelte:stats ssr compile done.
  vite:vite-plugin-svelte:stats package                 files     time     avg
  vite:vite-plugin-svelte:stats playground-kit-demo-app     5   54.9ms  11.0ms +0ms
  VITE v4.2.1  ready in 321 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
  vite:vite-plugin-svelte:stats prebundle libraries in progress ... +0ms
  vite:vite-plugin-svelte:stats prebundle libraries done.
  vite:vite-plugin-svelte:stats package                         files    time     avg
  vite:vite-plugin-svelte:stats carbon-icons-svelte              2002   7.22s   3.6ms
  vite:vite-plugin-svelte:stats carbon-components-svelte          206   1.86s   9.0ms +12s

@bluwy bluwy merged commit 568341e into main Apr 10, 2023
6 checks passed
@bluwy bluwy deleted the log-stats-debug branch April 10, 2023 14:54
@github-actions github-actions bot mentioned this pull request Apr 10, 2023
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.

None yet

2 participants