Rust Release mode compilation

Hello, we have fixed the issue. We had a problem with our cache. So now, it should work as expected:

for multiplayer games only: debug mode in IDE, release mode in arena

4 Likes

Thanks ! :slight_smile:

However, I am still a little disappointed with the performance of my code on UTTT. I have around 1100 simulations in round 2 in the IDE and 1700 in the arena. When I test the same code on my computer it gives me around 2100 simulations in debug and 37000 in release. That’s rather a huge difference! Do you specify any particular optimization level in release?

Thanks again!

We are using rustc directly with -O.

I see in the doc (https://www.mankier.com/1/rustc) that this equivalent to opt-level=2 and that what is called release mode in Cargo corresponds to opt-level=3.

So we would need to change -O to -C opt-level=3

5 Likes

Mmm, it doesn’t explain my difference. I tried with the opt-level=2 and it doesn’t change a lot. Do you also compile the libs with the -O flag? Using debug libs and opt-level=2 only for my code with rustc gives me around 3000 simulations, which is similar to the arena.

Mmm. Nope! We precompile the libs with a simple cargo build. So does this mean that we would need two versions of the libs one used when executing rust in the IDE (rustc -g) and one when submitting to the arena?

Or could we use the “release” libs all the time? But then what would be the impact from a debugging prespective?

IMHO It should be fine to have release libs all the time. I think the debug symbols are mainly useful for the code written in the IDE where most of the errors can occur. However, I don’t know all the implications that can happens and it is maybe safer to have 2 versions of the libs.

I would agree compiling the libs as release would be fine. Worst case ‘should’ be that the stack trace indicates the failure originating from the line that called to the lib, which should be a strong clue of miss-using a lib somehow. In my humble experience stack traces outside of main.rs are usually a form of cruft and the bug is clearly in main.

Thanks for looking into this!

Fixed! See https://www.codingame.com/forum/t/languages-update/1574/98

2 Likes

Thanks for the update. do we have opt level 3?

Yes opt level 3. But the improvement should come from compiling the libs in release mode. @WORST_DEV_EVER could you confirm that this is working as expected now?

5 Likes

I can confirm that it’s running way faster! The code I was using last time now gives me around 4400 simulations in the IDE and 29000 in the arena.

Thanks a bunch!

1 Like