Skip to content

benchmarks #94

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

Open
Hugos68 opened this issue Apr 16, 2025 · 11 comments
Open

benchmarks #94

Hugos68 opened this issue Apr 16, 2025 · 11 comments
Labels
documentation Improvements or additions to documentation

Comments

@Hugos68
Copy link

Hugos68 commented Apr 16, 2025

Sorry if this issue is inappropiate but I'm considering using tsdown instead of tsup/unbuild. But I wonder what improvements in speed this would result in. Are there any benchmarks of tsdown compared to tsup/unbuild/tsc, etc?

@sxzz
Copy link
Member

sxzz commented Apr 16, 2025

Sure we'll prepare that in the upcoming docs #93

@sxzz sxzz added the documentation Improvements or additions to documentation label Apr 17, 2025
@Gugustinette
Copy link
Collaborator

@sxzz I started a benchmark setup here : https://github.com/Gugustinette/bundler-benchmark

For now I only made an exemple bundling a thousand functions, do you have ideas of what would be relevant or not ? I'm not much into bundlers performance.

Meanwhile I'll improve the benchmark architecture and automate a few graph etc...

@Gugustinette
Copy link
Collaborator

btw this are the numbers on the thousand function bundling, pretty cool !

Image

@Gugustinette
Copy link
Collaborator

We can generate such graphs 👍

Image

@Hugos68
Copy link
Author

Hugos68 commented Apr 25, 2025

Damn, twice as fast as tsup! Nice!

@sxzz
Copy link
Member

sxzz commented Apr 25, 2025

Good job! We also need dts comparing

@Gugustinette
Copy link
Collaborator

Gugustinette commented Apr 25, 2025

@sxzz I added a dts benchmark.

However, the generated index.d.mts file is empty using tsdown, while it's not with tsup and unbuild 🤔
That's all I get :

//# sourceMappingURL=index.d.mts.map

@Gugustinette
Copy link
Collaborator

I updated tsdown to latest version and re-ran the benchmark, this is what we have now :

Image

Image

What should we do @sxzz ? Value some numbers here on the documentation (similar to Rolldown docs) ?

We need to close this issue in some way lol

@sxzz
Copy link
Member

sxzz commented May 1, 2025

I'm still working on improving performance, so please wait a bit longer (it may take until the dts plugin is ported to Rust).

@Gugustinette
Copy link
Collaborator

Sounds good to me ! 👍

@altano
Copy link

altano commented May 5, 2025

When compiling each package separately in a large monorepo, where each package is fairly small, you'll see much smaller gains (over tsc). I've been experimenting with tsdown and here's what I see for a ~200 line, single ts file, using isolated decl, generating everything (dts+.d.map+js.map):

➜  remark-mdx-toc git:(05-04-tsdown) ✗ rm -rf dist && hyperfine --warmup 1 node_modules/.bin/tsc
Benchmark 1: node_modules/.bin/tsc
  Time (mean ± σ):     476.9 ms ±  21.9 ms    [User: 1011.7 ms, System: 59.3 ms]
  Range (min … max):   457.2 ms … 513.8 ms    10 runs
 
➜  remark-mdx-toc git:(05-04-tsdown) ✗ rm -rf dist && hyperfine --warmup 1 node_modules/.bin/tsdown
Benchmark 1: node_modules/.bin/tsdown
  Time (mean ± σ):     328.9 ms ±  49.7 ms    [User: 421.4 ms, System: 61.2 ms]
  Range (min … max):   302.7 ms … 467.8 ms    10 runs

The gains are further reduced (as a relative %) when going through tools like pnpm run or turbo

I assume this is mostly node startup overhead at this point, and there's nothing tsdown can do, but I just wanted to point it out in case I'm hitting something unexpected.

I'm obviously comparing apples and oranges here though, since tsc isn't a bundler. But most of my packages are node based and don't need bundling, so the results are relevant to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants