Speed issue with program on Windows

I have a simple little program, that runs much slower on Windows 10 compared to other environments.

I have tried the following:

  • Windows 10
  • Ubuntu (subsystem running on the same Windows 10 box)
  • macOS

On the Ubuntu/macOS the app runs very fast, if I use the time command it would look like this:

real 0m0.008s
user 0m0.001s
sys 0m0.002s

On Windows it is visibly slow, I used Powershell Measure-Command and it came out at around 2.9 seconds.

The code if anyone is interested https://github.com/ian-hamlin/ipdec/blob/master/src/main.rs

Any advice on what I might have done wrong, or how I might go about finding why it is slow would be appreciated.

All are being built with cargo build --release

Could it be some virus scanner or Windows Defender that’s interfering (perhaps by scanning the file everytime it runs)?


When I ran your code on Windows it ran near instantly (34ms, not in release).

In the past I’ve experienced slowdown on Windows when cargo invocations block each other, for instance when the rust-enhanced Sublime extension checks my syntax at the same time I run a cargo command in the same directory in the terminal. Are you using cargo to run the binary as well, or are you calling it directly?


That is a good shout, I’ll see what I can disable on this machine and give it another go.

I was calling it directly from the target folder. But thank you for trying the code, I’m going to try turning off some things as suggested by the other poster and see if it helps.

1 Like