#### Archived

This topic is now archived and is closed to further replies.

# Speed differences between Linux and Windows - interesting

This topic is 5561 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

http://www.developerfusion.com/forums/topic.aspx?id=16681 This is interesting. A user at another forum I hang out at wrote a single loop application in C++, compiled them under VC++6 and GNU C++, and benchmarked them under both Win2K and Red Hat 9. The results, as detailed here, are somewhat remarkable. The source is also available, so you can download it yourself to draw your own conculsions.

SketchSoft OFFLINE | SketchNews

##### Share on other sites
I wouldn''t believe everything you read. I am seriously thinking of the possibility he built his windows code in the debug mode. This will cause a considerable amount of slowdown. I base this on the size of the file. Unless I''m writing a huge amount of code, or linking in a huge library, I''ve never had file sizes that big on a release mode in Visual Studio.

I also wonder if he was accounting for all processor usage. There are better ways to test then to use the windows task manager. I assume he was using time for linux. It is true linux can improve perfomance due to its finer graining on certain task. However, like I said. Read it with a grain of salt.

##### Share on other sites
quote:

the source code is exactly the same for windows and linux, both were compiled with default values.

If you create a project with MSVC, the default configuration is debug mode. Thus, the comparison is pretty pointless.

##### Share on other sites
GCC compiles without optimization by default, as well, but without the debugging information you probably get with MSVC. Debugging information could account for much of the filesize difference.

It''s pretty stupid to compare without optimization, though. Every decent package will compile with as much optimization as the package can handle anyway.

There are some significant performance differences (like IPC using pipes), but that stuff wasn''t mentioned.

##### Share on other sites
For a fair test it should be compiled with gcc under windows as well, not visual c++. The author mentions heavey use of new and delete whose implementations are dependent upon the runtime library - which will be different under different compilers.

##### Share on other sites
You also have to realize different versions of windows perform differently, and different versions of linux perform differently (linux has even more possibilities than windows).

Having a conclusive and unbiased speed test between windows and linux is pretty tough to do. That said, linux tends to run a lot faster for me than windows for everyone I know... a lot of that could be that I know how to go through and optimize

Drakonite

[Insert Witty Signature Here]

##### Share on other sites
I actually observed that UT 2k3 runs smoothly on an 800mhz , 256 mb ram, geforce 2 (redHat 9), but was hiccuping with win2k.

##### Share on other sites
better frames rates on quake 3 and UT.[/]

##### Share on other sites
"Under Linux, The compiled binary size = 22.6 kb
Under Windows The Compiled Binary sixe = 212.1 kb

almost 10 times bigger !
i putthis down to linked librarys, maybe windows was statically linking, and linux was dynamically linking ???????????
any comment ?????"

I have a comment. This guy''s an idiot. He''s obviously compiled with Debug. Not retail. The fact he could figured that one out pretty much ruins all credibility he may have mysteriously aquired. Debug EXEs are huge for even something like:

#define abs1(a) ((a<0) ? -(a) : (a))#define abs2(a) ((a<0) ? -a : a)#include <stdio.h>int abs3(int a){	return ((a<0)?-(a):(a));}void main(){	int i1=0, i2=0, i3=0, j1=0, j2=0, j3=0;	while(i1!=123)	{		printf("please enter 3 integers\n");		scanf("%d, %d, %d", &i1, &i2, &i3);		j1=abs1(++i1-2);		j2=abs2(++i2-2);		j3=abs3(++i3-2);		printf("j1 = %d, j2 = %d, j3 = %d\n", j1, j2, j3);	}}

That''s 181KB under VC6 in debug mode. BTW it''s one of my assignments for my programming class at a uni no less, which couldn''t possibly be any more lame.

As for why games get better performance under Linux; it''s because Linux has fewer layers between the OS and the card. Which is also why it''s a big giant bitch to install graphics cards on Linux.

I''ll keep my 3 frames per second and raise you 5 hours of work and \$5 worth of asprin.

Ben

[ IcarusIndie.com | recycledrussianbrides.com | Got Linux? ]

##### Share on other sites
I compiled his program as given and with retail it''s 60KB.

Ben

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633696
• Total Posts
3013402
×