Why is Visual Studio so slow when using 2 CPU cores?

Discussions related to using VirtualBox on Linux hosts.

Why is Visual Studio so slow when using 2 CPU cores?

Postby stkris » 9. Jan 2010, 01:25

Hi!

My laptop runs Debian and I use VirtualBox to run Windows XP and Visual Studio. But using 2 CPUs just make Visual Studio under XP really slow.

Stepping trought a particular function in the debugger I use 1:47 minutes with 1 CPU enabled, and 10:03 minutes with 2 CPUs enabled in VirtualBox.

On the contrary - a very CPU intensive application works twice as fast as you would expect when enabling 2 CPUs.

Can anybody think of any reason why VS 2008 is so slow on my setup? The log files show no exeptions or other error messages.

My system:
The Laptop:
* Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz
* Linux a 2.6.31-1-amd64 #1 SMP Mon Nov 16 04:44:38 UTC 2009 x86_64 GNU/Linux

The VirtualBox:
* VirtualBox version Installed: 3.1.2-56127_Debian_lenny
* Windows XP SP3 with this kernel: ACPI Multiprocessor PV v. 5.1.2600
stkris
 
Posts: 27
Joined: 21. Mar 2009, 00:17
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Win XP

Re: Why is Visual Studio so slow when using 2 CPU cores?

Postby togakangaroo » 3. Mar 2010, 17:47

I'm getting the same problem running Windows 7 as guest and host.

I gave 4 gig ram and 4 cores to the VM and it slowed to a crawl! Much better with only one core.
togakangaroo
 
Posts: 7
Joined: 13. Apr 2009, 21:35
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows 7

Re: Why is Visual Studio so slow when using 2 CPU cores?

Postby stkris » 9. Mar 2010, 17:14

So it looks to be independent of the host OS or client windows version.
stkris
 
Posts: 27
Joined: 21. Mar 2009, 00:17
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Win XP

Re: Why is Visual Studio so slow when using 2 CPU cores?

Postby togakangaroo » 9. Mar 2010, 17:24

At least as far as Windows is concerned, yes it seems to be independent
togakangaroo
 
Posts: 7
Joined: 13. Apr 2009, 21:35
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows 7

Re: Why is Visual Studio so slow when using 2 CPU cores?

Postby Martin » 9. Mar 2010, 23:46

You shouldn't assign all your CPU cores to a VM with a high I/O load. As soon as you need to access the network or disk, the host OS needs at least one CPU core to move the data, therefore the guest needs to pause to release the CPU.
When the guest has mostly high CPU load, you don't need to get "outside" the VM, so the guest has much more CPU resources available.
Martin
Volunteer
 
Posts: 2131
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Linux, OS/2

Re: Why is Visual Studio so slow when using 2 CPU cores?

Postby stkris » 17. Mar 2010, 17:45

I did a quick test on my Quad Core box running Debian (lenny):

Code: Select all   Expand viewCollapse view
virtual@ulet:~$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family   : 6
model      : 15
model name   : Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz

virtual@ulet:~$ uname -a
Linux ulet 2.6.26-2-686-bigmem #1 SMP Tue Mar 9 18:01:52 UTC 2010 i686 GNU/Linux

Installed: 3.1.4-57640_Debian_lenny


I ran a "rebuild all" in Visual Studio 2008 three times for each CPU count.
And then I tried three more so that VS2008 could use 1 or 3 threads while building the project.

1 CPUs 1 threads 1: 12.33
1 CPUs 1 threads 2: 12.44
1 CPUs 1 threads 3: 12.00

1 CPUs 3 threads 1: 12.01
1 CPUs 3 threads 2: 10.78
1 CPUs 3 threads 3: 11.81

2 CPUs 1 threads 1: 14.20
2 CPUs 1 threads 2: 13.37
2 CPUs 1 threads 3: 13.66

2 CPUS 3 threads 1: 12.98
2 CPUS 3 threads 2: 11.56
2 CPUS 3 threads 3: 10.79

3 CPUs 1 threads 1: 17.84
3 CPUs 1 threads 2: 15.51
3 CPUs 1 threads 3: 16.34

3 CPUs 3 threads 1: 15.38
3 CPUs 3 threads 2: 13.55
3 CPUs 3 threads 3: 12.80

4 CPUs 1 threads 1: 28.90
4 CPUs 1 threads 2: 24.62
4 CPUs 1 threads 3: 23.39

4 CPUs 3 threads 1: 27.62
4 CPUs 3 threads 2: 22.06
4 CPUs 3 threads 3: 25.67


As you can see the build time increases with each CPU I make available to VirtualBox.

Increasing the numbers of threads VS uses helps a bit, but does not stop the decline.

The best build time was with 1 CPU and 3 threads, and the worst with 4 CPUs and 1 thread.

I belive I will set all my VMs to use 1 CPU for now.
stkris
 
Posts: 27
Joined: 21. Mar 2009, 00:17
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Win XP

Re: Why is Visual Studio so slow when using 2 CPU cores?

Postby Samuel13 » 15. Apr 2010, 10:23

Samuel13
 
Posts: 20
Joined: 3. Nov 2009, 10:00
Primary OS: MS Windows 2003
VBox Version: PUEL
Guest OSses: Windows XP


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 22 guests