Thanks again for your time, It would be awasome if you could include time and rand crates (and -O) for the next contest.
Sorry for the long post, I hope I give you all the info.
PS: as you can see, only override the main.rs into already pre-build cargo project could also be a solution, compile time are very similar between rustc (0.10s) and cargo build (0.15s)
Thank you for your message. I’ve put on hold my work on Rust because I needed to work on another project but hopefully I’ll be able to work on that soon.
Our current problem is that the container is reinitialized after each build+execution and as shown in your experiments, building with cargo for the first time is slow (4.11s user in your case).
I agree with your suggestion to keep the compiled crates on the system. Actually, didn’t have the time to investigate, but there might be a way to specify the path of the crates in the Cargo.toml file. But the solution using rustc would be fine too.
Would you be willing to also add the itertools crate? It provides functionality similar to itertools in Python and really helps with some basic things. For example in Python you can split a string s (for example the input string) as follows:
a, b, c, d = s.split()
With itertools in Rust, you can write something similar.
use itertools::Itertools;
let (a, b, c, d) = s.split_whitespace().next_tuple.unwrap();
(Although, I can think of other ways to code this example as well without the crate, so it is not the end of the world if it can’t be added.)
I think time is not needed any more. The original proposal was from before the release of Rust 1.8.0, which introduced std::time::Instant and std::time::SystemTime.
I agree that lazy_static would be quite useful to introduce.
And everything else should be updated. I have recently had to work around a couple functions (such as Iterator::step_by) not yet existing in 1.27.