Hello Rust Programmers,
Today I started learning Rust, I started with Windows.
I saw hello world took little time on first run (execution) but it is fast on second run. Can I know the reason behind it.
Even all of my program takes little time on first run, then it is executing fast from second run.
Can any one let me know the reason or is my system problem.
Are you executing your program with
If so, that command will first compile your code into a binary, and then execute the binary.
For subsequent invocations of the command, there's nothing new to compile and so it runs directly the binary.
No, I am executing like a main.exe
main.exe -> This took little time
main.exe -> Took no time
There shouldn't be anything Rust-specific in this behavior. Rust programs don't have any state that persists across runs. Perhaps it's simply disk cache?
It could also be a virus scanner checking it the first time, and cached for subsequent execution.
Thanks I think that could be the issue. I executed on Linux and it works like a charm.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.