Skip to content

Source-to-Source Transcompiler from `.rinha` to Elixir. Runs on ERTS (Erlang Runtime System).

License

Notifications You must be signed in to change notification settings

rwillians/rinha-de-compilers--elixir-transcompiler

Repository files navigation


A Source-to-Source Transcompiler written in Elixir

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.

Instructions for the competition's organizers on how to run it

You might opt for using a pre-built image:

docker pull ghcr.io/rwillians/rinha-de-compilers--elixir-transcompiler:0.2.4

Clone

git clone git@github.com:rwillians/rinha-de-compilers--elixir-transcompiler.git rwillians
cd rwillians

Build

docker build -t rwillians .

Run a program once

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

Run a program multiple times (for benchmarking):

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

About me

I'm here¹ in the old blue bird at @rwillians_.

About

Source-to-Source Transcompiler from `.rinha` to Elixir. Runs on ERTS (Erlang Runtime System).

Topics

Resources

License

Stars

Watchers

Forks