Skip to content

Bencher Test Suite#242

Open
johnpalsberg wants to merge 57 commits into
mainfrom
john-benchmark
Open

Bencher Test Suite#242
johnpalsberg wants to merge 57 commits into
mainfrom
john-benchmark

Conversation

@johnpalsberg

Copy link
Copy Markdown
Contributor

Adds a test suite for benchmarking performance and file size via Bencher.

@sampsyo sampsyo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great; thanks for getting this started! I have a few granular coding suggestions before we merge.

Also, can we please put these new scripts into a directory? We could reuse the bench/ top-level directory that I made for my old infrastructure or pick a new, different name.

Comment thread tests/.gitignore Outdated
Comment on lines +31 to +32


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's revert these changes, because they are kinda "diff noise."

Comment thread filesize_benchmark.py Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you please apply some automated formatting to your Python code, via Ruff? If you already have uv installed, this is as easy as running:

uvx ruff format *.py

Comment thread filesize_benchmark.py Outdated
}
}

print(json.dumps(bencher_json))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This can be more succinctly written as:

json.dump(bencher_json, sys.stdout)

Comment thread filesize_benchmark.py Outdated
Comment on lines +14 to +16
size_bytes_1 = float(benchmark("tests/chr6.C4.gfa")) / 1000.0
size_bytes_2 = float(benchmark("tests/DRB1-3123.gfa")) / 1000.0
size_bytes_3 = float(benchmark("tests/LPA.gfa")) / 1000.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It seems like this will be a little easier to maintain if we make this more "data-driven," i.e., use a list for the filename and loop over it? Like this:

gfa_files = ["tests/chr6.C4.gfa", "tests/DRB1-3123.gfa", "tests/LPA.gfa"]
sizes = {name: float(benchmark(name)) / 1000.0 for name in gfa_files}

Then use that size dictionary in the Bencher results here.

Comment thread .github/workflows/bencher.yml Outdated
@@ -0,0 +1,44 @@
on:
push:
branches: john-benchmark

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's do this for all branches, so we can see this working on main when it's merged.

Comment thread filesize_benchmark.py Outdated
import json
import subprocess

subprocess.run(["cargo", "build", "--release"], check = True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe this is silly, but do we really want to do the cargo build here? It seems somewhat odd that the benchmarks script would do the rebuild itself rather than just using whatever had already been built. Furthermore, the fact that the responsibilities for "installing" fgfa are spread across two places (here and the GitHub Actions stuff, which amends $PATH) is a tad confusing.

I gently suggest that we remove this and instead add a step to the Actions script to do the build.

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