Skip to content

perf: rewrite not_m_separated_for_all_subsets() in Rust #8

perf: rewrite not_m_separated_for_all_subsets() in Rust

perf: rewrite not_m_separated_for_all_subsets() in Rust #8

Workflow file for this run

name: benchmark
on:
pull_request:
permissions: read-all
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: r-lib/actions/setup-r@v2
with:
r-version: release
use-public-rspm: true
- name: Install dependencies
run: Rscript -e 'install.packages(c("remotes", "bench", "caugi", "optparse", "tibble"))'
- name: Install PR branch package
run: Rscript -e 'remotes::install_local(".", upgrade="never")'
- name: Run benchmark on PR branch
run: |
Rscript .github/workflows/benchmark.R
- uses: actions/checkout@v6
with:
ref: main
path: main_branch
- name: Run benchmark on main branch
run: |
Rscript .github/workflows/benchmark.R --output main_time.rds
- name: Compare results
run: |
Rscript -e '
pr <- readRDS("pr_time.rds")
main <- readRDS("main_time.rds")
slowdown_median <- (pr$median - main$median) / main$median * 100
# Make a table
result_table <- tibble::tibble(
Benchmark = names(pr$expression),
PR_median = pr$median,
PR_total_time = pr$total_time,
Main_median = main$median,
Main_total_time = main$total_time,
Slowdown_percent_median = as.numeric(slowdown_median)
)
cat("\n=== Benchmark Comparison ===\n")
print(result_table, row.names = FALSE, width = Inf)
if (any(slowdown_median >= 20)) {
cat("\nERROR: PR branch is >=20% (median time) slower than main for at least one benchmark entry\n")
stop("Benchmark check failed")
} else {
cat("\nBenchmark check passed: PR is not more than 20% (median time) slower than main\n")
}
'