Skip to content

benwis/customs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customs

A crate to make it slightly easier to benchmark cargo runs under different settings.

Installation

  1. Install hyperfine, which we use for benchmarking. There are many ways to do it, but one is below
cargo install hyperfine
  1. Install mold, which might involve compiling it. See the page for details. I use Nix, which has a package for it already. It is an alternative linker for Rust programs written by @rui314. Consider sponsoring them if it works well for you
  2. Install cranelift, which is now included in as a rustup component in the latest nightly for x86_64 linux. Details below. It shows that it works for other platforms, see the README for details
rustup component add rustc-codegen-cranelift-preview --toolchain nightly

Usage

  1. Create a server-dev profile in Cargo.toml by adding the section below. Add a section to set the opt-level for your crate and its dependencies
[profile.dev]
opt-level = 0

[profile.dev.package."*"]
opt-level = 0

[profile.server-dev]
inherits="dev"
  1. Enable the unstable codegen-backend feature in .cargo/config.toml. If the folder or file doesn't exist, create them. To actually enable it, you need to add codegen-backend = "cranelift" below the profile name, but the tool will handle this for you.
[unstable]
codegen-backend = true

[profile.server-dev]
  1. Run it
cargo run -- --cargo-dir=<"path_to_dir_to_compile"> --output-dir=<"path to dir to put output json files in" > --num-runs=3
  1. Available commands can be found
cargo run -- --help

Note

This is currently in a very beta state. I will probably break the bin crate out into an example.

About

A crate to make it slightly easier to benchmark cargo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published