Open untitaker opened 2 years ago
You can probably write a Dockerfile to install valgrind and run the bench suite inside the container. Then launch it with a shell script. Seems pretty straightforward. https://www.gungorbudak.com/blog/2018/06/13/memory-leak-testing-with-valgrind-on-macos-using-docker-containers/
Another alternative: Install a fork of valgrind
that works on macOS
Unfortunately valgrind-macos seems to give results that are all over the place. Each run returns different numbers, whereas in a Docker container it seems to always return the same numbers until I change the code.
For people who are curious, there are two ways to use this crate on macOS once you’ve installed valgrind
.
Use the released version and put a fake setarch
into your $PATH
. My horrible hack looks like this:
#!/bin/bash
while [[ "$1" != valgrind && "$1" != "" ]] ; do
shift
done
exec "$@"
iai = { git = "https://github.com/bheisler/iai" }
It seems dynamic linker startup is quite noisy.
I created https://github.com/bheisler/iai/pull/26 which makes things a lot more stable for me.
I'm thinking of ways to run this on platforms where valgrind is not easily available. My current thinking is that iai could launch a Docker container with valgrind preinstalled and run its benchmarks there, then delete the container again. Docker (and the Linux VM that comes with Docker for Mac) is already "priced in" cost in my developer experience.
I don't think it makes a ton of sense to do all of Rust development in Docker though, after all compilation is still faster on M1, and most other things work.