Fancy names apart, the core idea here is that we take a program .rinha
, parse it, transpile it to Elixir AST and then compile it as its own module.
You might opt for using a pre-built image:
docker pull ghcr.io/rwillians/rinha-de-compilers--elixir-transcompiler:0.2.4
git clone git@github.com:rwillians/rinha-de-compilers--elixir-transcompiler.git rwillians
cd rwillians
docker build -t rwillians .
docker run \
--mount type=bind,source="/absolute/path/to/source.rinha",target="/var/rinha/source.rinha" \
--memory=2gb \
--cpus=2 \
rwillians
# compile once, run the program 1 time
docker run \
--mount type=bind,source="/absolute/path/to/source.rinha",target="/var/rinha/source.rinha" \
--memory=2gb \
--cpus=2 \
rwillians /var/rinha/source.rinha 10
# ^ compile once, run the program 10 times
time docker run \
--mount type=bind,source="/absolute/path/to/source.rinha",target="/var/rinha/source.rinha" \
--memory=2gb \
--cpus=2 \
rwillians /var/rinha/source.rinha 1000000 &>/dev/null
# ^ ^ redireciona stdout para /dev/null
# ^ compile once, run the program 1Mi times
I'm here¹ in the old blue bird at @rwillians_.