Skip to content

Comments

tools: Add a tool to aid with running benchmarks#1454

Merged
davidlattimore merged 1 commit intomainfrom
push-rrsstntysskk
Jan 15, 2026
Merged

tools: Add a tool to aid with running benchmarks#1454
davidlattimore merged 1 commit intomainfrom
push-rrsstntysskk

Conversation

@davidlattimore
Copy link
Owner

No description provided.

README.md Outdated
![Benchmark of lld, mold and wild linking librustc-driver](images/benchmarks/librustc-driver.svg)

Finally, for an especially large binary, we link the chromium web browser with debug info.
See [benchmarks/ryzen-9955hx.md](benchmarks/ryzen-9955hx.md) for benchmark results.
Copy link
Collaborator

@lapla-cogito lapla-cogito Jan 14, 2026

Choose a reason for hiding this comment

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

While the benchmark content seems adequate, I believe the README should also include key benchmark results (particularly those related to link times) as before. Many new users of Wild likely have the question "What makes it so superior to existing linkers?", so having an answer readily available in plain sight would be meaningful. (In this regard, I think moving the "What's working?", "What isn't yet supported?" and benchmarks to the top of the README would be a good idea. Of course, these may not fall under the scope of this PR, though)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I agree. A large number of benchmarks is fine, but then we should have a TL;DR section summarizing the results a bit.

Comment on lines 63 to 66
markdown.push_str(&format!(
"![Benchmark of linking {}]({svg_filename})\n\n",
benchmark.config.name
));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there should be the text with name of the scenario before the images. It'd allow to quickly search if you knew what you're looking for.

Copy link
Contributor

Choose a reason for hiding this comment

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

While we're at it, some rough table of contents would be nice too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fully agree with both the suggestions! Regarding the later one - I would also include ratio (%) comparison for easier orientation. Digesting the speed-up from the pictures needs some mental capacity :)

Copy link
Owner Author

Choose a reason for hiding this comment

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

I've just prototyped the % change thing. Initially I made the baseline be whatever was slowest (or largest for memory). I didn't really like that though because it sometimes was LLD, sometimes was Mold and if GNU ld was included, then that was the baseline. I contemplated making LLD always be the baseline, but in the end decided to make the last benchmark (which is the latest version of Wild) be the baseline. That means that the other linkers are generally reported as positive percentage increases - except for ripgrep-memory where GNU ld uses less memory than Wild. You can see the results here:
https://github.com/davidlattimore/wild/blob/a9ed091c45244d5ca05928b02448144281c343ac/benchmarks/ryzen-9955hx.md

Copy link
Contributor

@karolzwolak karolzwolak left a comment

Choose a reason for hiding this comment

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

I like the svgs, but numbers on the y axis aren't too readable in some scenarios. For example 30000 MiB for the clang-debug memory. We should put some separators in between, or better adjust the unit prefixes.

bumpalo-herd = "0.1.2"
bytesize = "2.0.0"
clap = { version = "4.0.0", features = ["derive"] }
clap = { version = "4.1.0", features = ["derive"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

I may be a bit too pedantic here, but is there any reason to update the version here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be due to the minimal-versions check: https://github.com/davidlattimore/wild/actions/runs/20982989095/job/60311647318

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yep, that's it exactly. With this change, Wild no longer builds if we use clap version 4.0.0, so I bumped the minimum version. 4.1.0 is three years old, so it's unlikely that anyone would want to use an older version together with any of our crates.

@marxin
Copy link
Collaborator

marxin commented Jan 14, 2026

For example 30000 MiB for the clang-debug memory. We should put some separators in between, or better adjust the unit prefixes.

Can we rely on bytesize crate?

@marxin
Copy link
Collaborator

marxin commented Jan 14, 2026

Generally speaking - I really like the graphs and especially the improvement that has been achieved among the Wild's releases. It's even better investment for the future as the time series is going to be even more interesting.

@davidlattimore davidlattimore force-pushed the push-rrsstntysskk branch 5 times, most recently from a9ed091 to 0aff659 Compare January 15, 2026 03:49
@davidlattimore
Copy link
Owner Author

Thanks for the feedback folks!

I've added a few interesting benchmarks back to the README. We also now directly link to each benchmark page from the readme.

The newly added percentages at the bottom of the charts show how each benchmark result differs from the latest version of wild. Using the latest version of wild as the baseline makes sense since this allows us to easily compare it with previous versions of wild or compare it with other linkers.

I added spaces to make the numbers over 1000 more readable. I didn't want to have different charts use different units, because it could be easy to miss that the unit has changed.

I've added a Raspberry Pi benchmarks page and added one Raspberry Pi benchmark back to the main README.

I also added confidence intervals, which show how confident we are in the mean that we computed for each benchmark. Where the confidence interval is too large, we could reduce it by running more iterations for that benchmark.

@davidlattimore davidlattimore force-pushed the push-rrsstntysskk branch 3 times, most recently from c694b52 to c821900 Compare January 15, 2026 04:50
@davidlattimore davidlattimore marked this pull request as ready for review January 15, 2026 04:52
@davidlattimore
Copy link
Owner Author

This PR is now just the tool. The updated benchmarks are now part of the PR to release 0.8.0 - #1456

@davidlattimore davidlattimore merged commit e1c79f2 into main Jan 15, 2026
20 checks passed
@davidlattimore davidlattimore deleted the push-rrsstntysskk branch January 15, 2026 06:40
@TechnoPorg
Copy link
Contributor

When I try to run benchmarks with this tool, it doesn't seem like it sets paths correctly:

Error returned from OUT="/tmp/linker-benchmark-out/" "/home/maya/.cache/wild/bench/zed-release/run-with" "target/dist/wild"
wild: error: Failed to open `/tmp/linker-benchmark-out/`
  Caused by:
    Is a directory (os error 21)

I've patched it with args.tmp.join("out")... in benchmarking.rs locally for now.

@davidlattimore
Copy link
Owner Author

It's supposed to be a file. Perhaps delete the directory?

@davidlattimore
Copy link
Owner Author

I perhaps should have mentioned that this tool is really intended for doing bulk runs of benchmarks. i.e. for running the benchmarks for a release. For one-off single-program benchmarks, I'd still recommend using poop or hyperfine.

@TechnoPorg
Copy link
Contributor

TechnoPorg commented Jan 16, 2026

Ah, that makes sense. I was thrown off by the fact that the PathBuf formatting is adding a trailing slash to the path in the command:

"stat" "-f" "-c" "%T" "/tmp/linker-benchmark-out/"

which fails with stat 9.9 on my system:

stat: cannot read file system information for '/tmp/linker-benchmark-out/': Not a directory

Edit: never mind, I messed up, so the above part isn't relevant.

It also doesn't create the file beforehand, so I wonder if it would be better to just check the parent directory of args.tmp instead.

@davidlattimore
Copy link
Owner Author

Ah, that makes sense. I added the call to "stat" after I'd been running the tool for a while, so the output file would have already existed for me. Yes, checking the parent directory sounds like the thing to do. You're welcome to send a PR to fix it if you'd like? Otherwise, I'll do it.

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.

5 participants