Motivation
==========
The self-packed one sort-of worked, but was rather flaky, while the one
from rustup obviously works, as it's an officially distributed part.
Running it
==========
Instead of the `cargo clif [build, etc.]` you now need to run (on nightly):
```
RUSTFLAGS="-Zcodegen-backend=cranelift" cargo build
```
Performance
===========
On my system I noticed, that a debug build takes around 20 sec *more*
with cranelift, compared to the default LLVM backend.
One possible hypothesis, for that could be, that cranelift does
not link via `mold` but instead still uses GNU's `gold`.
On the other hand, the performance decrease could also be caused
by the fact, that it's an early preview and some optimizations are
still lacking.
I measured the linking times by running `cargo rustc --bin trinitrix --
-Z time-passes`, which resulted in following data:
`ld`:
37.794s to link
`mold`:
21.389s to link
The downside for now is, that this requires to have mold installed to
build trinitrix (The nix flake based direnv already has it) and that
mold only works on linux.
A nix flake is a reproducible way to describe the building process
to [nix](1).
See [the nix download page](1), on how to install nix. Afterwards
running `nix build` in the repository will result in a successful build.
Flakes and nix-commands are still experimental so they must be enabled
as described in [the corresponding wiki entry](2)
[1]: https://nixos.org/download.html#nix
[2]: https://nixos.wiki/wiki/Flakes#Enable_flakes.