Run y.rs bench in CI
This commit is contained in:
parent
d1024b6560
commit
79f4cc0822
42
.github/workflows/main.yml
vendored
42
.github/workflows/main.yml
vendored
@ -185,3 +185,45 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
|
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
|
||||||
run: ./y.rs abi-cafe
|
run: ./y.rs abi-cafe
|
||||||
|
|
||||||
|
bench:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Cache cargo target dir
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: build/cg_clif
|
||||||
|
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache cargo bin dir
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/bin
|
||||||
|
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-bin-dir-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Use sparse cargo registry
|
||||||
|
run: |
|
||||||
|
cat >> ~/.cargo/config.toml <<EOF
|
||||||
|
[unstable]
|
||||||
|
sparse-registry = true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Install hyperfine
|
||||||
|
run: cargo install hyperfine
|
||||||
|
|
||||||
|
- name: Prepare dependencies
|
||||||
|
run: ./y.rs prepare
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: ./y.rs build --sysroot none
|
||||||
|
|
||||||
|
- name: Benchmark
|
||||||
|
run: ./y.rs bench
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
use super::path::{Dirs, RelPath};
|
use super::path::{Dirs, RelPath};
|
||||||
use super::prepare::GitRepo;
|
use super::prepare::GitRepo;
|
||||||
use super::rustc_info::get_file_name;
|
use super::rustc_info::get_file_name;
|
||||||
use super::utils::{hyperfine_command, is_ci, spawn_and_wait, CargoProject, Compiler};
|
use super::utils::{hyperfine_command, spawn_and_wait, CargoProject, Compiler};
|
||||||
|
|
||||||
static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
|
static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
|
||||||
"ebobby",
|
"ebobby",
|
||||||
@ -54,10 +54,7 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let run_runs = env::var("RUN_RUNS")
|
let bench_runs = env::var("BENCH_RUNS").unwrap_or_else(|_| "10".to_string()).parse().unwrap();
|
||||||
.unwrap_or(if is_ci() { "2" } else { "10" }.to_string())
|
|
||||||
.parse()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
|
eprintln!("[BENCH COMPILE] ebobby/simple-raytracer");
|
||||||
let cargo_clif =
|
let cargo_clif =
|
||||||
@ -83,7 +80,7 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let bench_compile =
|
let bench_compile =
|
||||||
hyperfine_command(1, run_runs, Some(&clean_cmd), &llvm_build_cmd, &clif_build_cmd);
|
hyperfine_command(1, bench_runs, Some(&clean_cmd), &llvm_build_cmd, &clif_build_cmd);
|
||||||
|
|
||||||
spawn_and_wait(bench_compile);
|
spawn_and_wait(bench_compile);
|
||||||
|
|
||||||
@ -96,7 +93,7 @@ fn benchmark_simple_raytracer(dirs: &Dirs, bootstrap_host_compiler: &Compiler) {
|
|||||||
|
|
||||||
let mut bench_run = hyperfine_command(
|
let mut bench_run = hyperfine_command(
|
||||||
0,
|
0,
|
||||||
run_runs,
|
bench_runs,
|
||||||
None,
|
None,
|
||||||
Path::new(".").join(get_file_name("raytracer_cg_llvm", "bin")).to_str().unwrap(),
|
Path::new(".").join(get_file_name("raytracer_cg_llvm", "bin")).to_str().unwrap(),
|
||||||
Path::new(".").join(get_file_name("raytracer_cg_clif", "bin")).to_str().unwrap(),
|
Path::new(".").join(get_file_name("raytracer_cg_clif", "bin")).to_str().unwrap(),
|
||||||
|
Loading…
Reference in New Issue
Block a user