windows – Hyper-V Win11 image faster than physical machine


I started Hyper-V Virtual Machine on my development machine to perform some tests. The virtual machine is running on the same hardware as physical machine. I noticed my application start 2x faster when run on the VM. Both VM and physical machine are Win11 24H2

My first though was that i have problem with my software application and start profiling. I noticed that there is no single method call is faster but every methods calls are significantly faster.

My 2nd though was, probably antivirus software on the physical machine can do that. Check that and both are running MS Defender. Disable/enable doesn’t make a difference.

Then I tried to install all development tools from the physical machine on the VM, because I thought they somehow install some bloatware that can slow down the performance. I did that and the VM is still faster. I tried to perform all the test with VM shuttled down but the physical machine doesn’t get any faster.

Then I noticed it is not only my application. Visual Studio starts faster. I installed also, JetBrains dotTrace and I can see it start faster on the VM to.

What the hell is going on? How is that possible? Any ideas what to check or might cause that mystery? I can’t believe VM can be faster or can it?

It important that I am measuring hot starts of the application. That means i first start the app multiple times before starting the measure the startup time. This is important for the caching of .dll files.

Here some other stuff that might be related:

  1. Bitlocker is turned off on the physical machine
  2. Both machines has developer mode turned on
  3. The physical machine only have a Dev Drive turned on (Note sure if might be related)
  4. Physical machine support hardware virtualization and it is enabled.
  5. CPU is Intel 12th gen
  6. VM runs on 4 cores.

P.S.
I found this: https://community.spiceworks.com/t/vm-hard-disk-speed-much-faster-than-host-disk-speed/603712/16

Virtual Disks are files and as such are kept in host system memory to the extent possible for performance reasons. This translates into very fast benchmarking times and can lead to very long host shutdowns as those disks are flushed back to the physical disks. The virtualization OS (Hyper-V, ESX, Zen, etc.) uses disk caching just like any general purpose OS It then updates the physical disk in background.

Leave a Reply

Your email address will not be published. Required fields are marked *