Skip to content

Benchmarking#34

Draft
programLyrique wants to merge 28 commits intomainfrom
benchmarking
Draft

Benchmarking#34
programLyrique wants to merge 28 commits intomainfrom
benchmarking

Conversation

@programLyrique
Copy link
Copy Markdown
Collaborator

@programLyrique programLyrique commented Jun 18, 2025

Add rebench and more niceties.

The rebench setup is explained in benchmarking. It is inspired by https://github.com/reactorlabs/RBenchmarking but
simplifies the setup and makes it work with the client/server architecture:

  • adapt the run.sh to run the server before starting rebench
  • create a custom bin/Rscript that correctly pass LD_PRELOAD with the LLVM library. I placed in the client but another place might be also coherent.
  • Add RebenchDB. Currently, only the raw data and the summary at the end are printed, on the terminal. No Codespeed either

The original rebench.conf used GNU time to estimate the memory usage. My rebench (last one from pip) crashes on the % escape character to format the time output so I removed this memory estimation.

@programLyrique programLyrique self-assigned this Jun 18, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR sets up a rebench-based benchmarking suite for the client/server architecture and adds several benchmark scripts plus CI updates.

  • Introduce new benchmark scripts (Shootout, areWeFast, RealThing) with execute and verifyResult/innerBenchmarkLoop harnesses
  • Add a Docker-based R build in the devcontainer and update the GitHub Actions pipeline to build/push the image and run benchmarks
  • Remove obsolete Maven CI workflow in favor of unified pipeline.yml

Reviewed Changes

Copilot reviewed 20 out of 111 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
benchmarking/Benchmarks/shootout/binarytrees_2.r Add second variant of binarytrees shootout benchmark
benchmarking/Benchmarks/shootout/binarytrees.r Add original binarytrees shootout benchmark
benchmarking/Benchmarks/areWeFast/*.r Add storage, random, mandelbrot, bounce, and harnesses
benchmarking/Benchmarks/RealThing/*.r Add RealThing benchmarks (volcano, convolution, flexclust) and harnesses
.github/workflows/pipeline.yml New unified CI workflow for Docker image and benchmarks
.devcontainer/devcontainer.json Remove obsolete postCreateCommand
.devcontainer/build-gnur-in-docker.sh Script to compile and install GNU R in container
.devcontainer/Dockerfile Integrate R build script into the devcontainer image

b <- as.double(b)
na <- length(a)
nb <- length(b)
ab <- double(na + nb)
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

The convolution result is allocated with length na+nb but only na+nb-1 elements are ever written; this leads to an extra zero at the end. Consider using double(na + nb - 1).

Suggested change
ab <- double(na + nb)
ab <- double(na + nb - 1)

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +83
verifyResult <- function(result, innerIterations) {
if (innerIterations == 500) { return (result == 191) }
if (innerIterations == 750) { return (result == 50) }
if (innerIterations == 1) { return (result == 128) }

write(paste(paste("No verification result for", innerIterations), "found\n"), stdout())
write(paste(paste("Result is:", result), " \n"), stdout())
return (FALSE);
}

Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

The verifyResult function only handles specific iteration values (500, 750, 1). For the default size (3000) this will always return FALSE and stop the benchmark. Add a case for the default or adjust defaults to match verification.

Suggested change
verifyResult <- function(result, innerIterations) {
if (innerIterations == 500) { return (result == 191) }
if (innerIterations == 750) { return (result == 50) }
if (innerIterations == 1) { return (result == 128) }
write(paste(paste("No verification result for", innerIterations), "found\n"), stdout())
write(paste(paste("Result is:", result), " \n"), stdout())
return (FALSE);
}
verifyResult <- function(result, innerIterations) {
if (innerIterations == 500) { return (result == 191) }
if (innerIterations == 750) { return (result == 50) }
if (innerIterations == 1) { return (result == 128) }
if (innerIterations == 3000) { return (result == 726) } # Expected result for size 3000
write(paste(paste("No verification result for", innerIterations), "found\n"), stdout())
write(paste(paste("Result is:", result), " \n"), stdout())
return (FALSE);
}

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +23
buildTreeDepth <- function(depth, random) {
count <<- count + 1
if (depth == 1) {
return (c(nextRandom() %% 10 + 1))
} else {
array <- vector("list", length = 4)
for (i in 1:4) {
array[[i]] <- buildTreeDepth(depth - 1, random)
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

The random parameter is never used inside buildTreeDepth; consider removing it to avoid confusion.

Suggested change
buildTreeDepth <- function(depth, random) {
count <<- count + 1
if (depth == 1) {
return (c(nextRandom() %% 10 + 1))
} else {
array <- vector("list", length = 4)
for (i in 1:4) {
array[[i]] <- buildTreeDepth(depth - 1, random)
buildTreeDepth <- function(depth) {
count <<- count + 1
if (depth == 1) {
return (c(nextRandom() %% 10 + 1))
} else {
array <- vector("list", length = 4)
for (i in 1:4) {
array[[i]] <- buildTreeDepth(depth - 1)

Copilot uses AI. Check for mistakes.
USING_OSX=0
fi

if [[ ! -f ${R_DIR}/.git ]]; then
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

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

Checking for .git with -f will always trigger since .git is a directory, not a file. Use -d to test for its existence.

Suggested change
if [[ ! -f ${R_DIR}/.git ]]; then
if [[ ! -d ${R_DIR}/.git ]]; then

Copilot uses AI. Check for mistakes.
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.

2 participants