Which compilation mode is used on coding game?

Everything is in the title :slight_smile:
Does anybody knows the answer ?

There is some info about compilation of Rust in these two threads:

Not sure if this has all the information you were looking for?

  • danBhentschel

Ha… this is a problem indeed. I give it a shot on a big program for a difficult solo game, and indeed, I can see compilation times going from 0.9s in debug to about three in release.

This thread gives some hints, though. I’m not sure if your infrastructure keep “stuff” around from one run to the other, but incremental compilation of function (which we hope will see the light of day in 2017) should help.

In the meantime, I assume your infrastructure runs linux, so it may be worth try a gold as a linker.

As for time and rand, a simple cargo program with some randomness and a time::get_time call get 0.81s to compile with cargo (more on the first run of cargo as the crates have to be compiled too). But if i extract the rustc call from cargo (run “cargo -v build” to see the actual rustc command lines) i’m down to about 0.2s… (still in debug). So by caching time and rand somewhere, and crafting the (long) rustc line, we could save some time here.

With such a simple example, though, the compilation time stays at about 0.2s, even in release mode. There is no template, no function to inline, so not much to do for the optimizer in my trivial example.

1 Like

Thank you for your answer.
This partly gave me what I am looking for.
As cargo is not used, I am wondering if the -O (or -C opt-level=?) is used ? (I could not find this info online :no_mouth: )

At the moment, every languages on CG are compiled/run without optimization flag (debug purpose > time). Plus, we don’t keep “stuff” around: you work on a new environnement each play.

But, it may change since we’re rebuilding our infra for the Learning project and some ideas might be reuse for the puzzles.


Thank you very much !