C# vs. C++ performance [modified] (Contest)
-
On another thread some posted this link: http://www.csharphelp.com/archives2/archive458.html[^] Now I was very suprised by this bad C# result, it's not at all what I experience! So I decided to test my self! I have .NET 2 and gcc 3.4.4 I compiled like this: CPP> gcc -O3 -o sieve2.exe sieve.cpp -lstdc++ C#> csc /o+ /nologo /out:sieve.exe Sieve.cs I got: C# 10000 Milliseconds = 1156 C++ 10000 Milliseconds = 1313 Haheum..... what else can I say? -- modified at 11:18 Tuesday 1st August, 2006 I propose a Contest. Post a small C++ performance test program here (less than 200 readable lines). I'll try to beat it with a C# version!
-
On another thread some posted this link: http://www.csharphelp.com/archives2/archive458.html[^] Now I was very suprised by this bad C# result, it's not at all what I experience! So I decided to test my self! I have .NET 2 and gcc 3.4.4 I compiled like this: CPP> gcc -O3 -o sieve2.exe sieve.cpp -lstdc++ C#> csc /o+ /nologo /out:sieve.exe Sieve.cs I got: C# 10000 Milliseconds = 1156 C++ 10000 Milliseconds = 1313 Haheum..... what else can I say? -- modified at 11:18 Tuesday 1st August, 2006 I propose a Contest. Post a small C++ performance test program here (less than 200 readable lines). I'll try to beat it with a C# version!
Super Lloyd wrote:
Haheum..... what else can I say?
Use the Intel compiler. :) It is so talented, you can even turn on emulation of MS compiler bugs if necessary. :laugh:
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
On another thread some posted this link: http://www.csharphelp.com/archives2/archive458.html[^] Now I was very suprised by this bad C# result, it's not at all what I experience! So I decided to test my self! I have .NET 2 and gcc 3.4.4 I compiled like this: CPP> gcc -O3 -o sieve2.exe sieve.cpp -lstdc++ C#> csc /o+ /nologo /out:sieve.exe Sieve.cs I got: C# 10000 Milliseconds = 1156 C++ 10000 Milliseconds = 1313 Haheum..... what else can I say? -- modified at 11:18 Tuesday 1st August, 2006 I propose a Contest. Post a small C++ performance test program here (less than 200 readable lines). I'll try to beat it with a C# version!
gcc is not exactly known for the speed of its code. try MSVC or Intel.
Why donchoo take a peekchur mayn? OK, cleeeeek
-
gcc is not exactly known for the speed of its code. try MSVC or Intel.
Why donchoo take a peekchur mayn? OK, cleeeeek
I tried cl /O2 /EHsc sieve.cpp It compiled without any message but crashed right away... Now, if C++ is so much more powerfull, why do I need an optimized compiler? :doh:
-
I tried cl /O2 /EHsc sieve.cpp It compiled without any message but crashed right away... Now, if C++ is so much more powerfull, why do I need an optimized compiler? :doh:
Super Lloyd wrote:
Now, if C++ is so much more powerfull, why do I need an optimized compiler?
you realize the C# compiler optimizes your code, too. right ?
Why donchoo take a peekchur mayn? OK, cleeeeek
-
I tried cl /O2 /EHsc sieve.cpp It compiled without any message but crashed right away... Now, if C++ is so much more powerfull, why do I need an optimized compiler? :doh:
That's the whole point. C++ is more powerfull if you optimize it. The compilers for C++ have way more optimizing options, since they can do stuff different on machinecode level. C# has to rely on the optimisations of the IL JIT compiler. Its funny to see that C# can be faster ;P Although the comparison is a little off, because of the difference in optimizations used.
WM.
What about weapons of mass-construction? -
gcc is not exactly known for the speed of its code. try MSVC or Intel.
Why donchoo take a peekchur mayn? OK, cleeeeek
I tried to make a C++ project with VS... Obviously I'm not used to.. It doesn't recognize 'vector' :sigh: could anyone do the test? :sigh: (otherwise I could believe you are afraid to see C++ be beaten)
-
I tried cl /O2 /EHsc sieve.cpp It compiled without any message but crashed right away... Now, if C++ is so much more powerfull, why do I need an optimized compiler? :doh:
Super Lloyd wrote:
why do I need an optimized compiler?
That's like asking 'why do I need second through fifth gear?' in a 5-speed car.
Software Zen:
delete this;
-
Super Lloyd wrote:
why do I need an optimized compiler?
That's like asking 'why do I need second through fifth gear?' in a 5-speed car.
Software Zen:
delete this;
Hey, GCC is not so bad! ;P I need some penguin right now! ;P
-
On another thread some posted this link: http://www.csharphelp.com/archives2/archive458.html[^] Now I was very suprised by this bad C# result, it's not at all what I experience! So I decided to test my self! I have .NET 2 and gcc 3.4.4 I compiled like this: CPP> gcc -O3 -o sieve2.exe sieve.cpp -lstdc++ C#> csc /o+ /nologo /out:sieve.exe Sieve.cs I got: C# 10000 Milliseconds = 1156 C++ 10000 Milliseconds = 1313 Haheum..... what else can I say? -- modified at 11:18 Tuesday 1st August, 2006 I propose a Contest. Post a small C++ performance test program here (less than 200 readable lines). I'll try to beat it with a C# version!
Super Lloyd wrote:
C++ 10000 Milliseconds = 1313
change to 562 Intel 8.0 and MSVC 6.0 You are running twice the time of "last generation's technology." :) shall I load up Intel 9.0 on another machine and make the difference greater? -- modified at 11:47 Tuesday 1st August, 2006
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
I tried cl /O2 /EHsc sieve.cpp It compiled without any message but crashed right away... Now, if C++ is so much more powerfull, why do I need an optimized compiler? :doh:
Super Lloyd wrote:
why do I need an optimized compiler?
you have one in C#, which is an optimizing compiler, just different concept. If you want to compare non-optimizing C++ to optimized C# and claim a definite win, you really need to rethink.
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
Hey, GCC is not so bad! ;P I need some penguin right now! ;P
Super Lloyd wrote:
Hey, GCC is not so bad!
Nope, it's only slower than C#, that is a great selling point! :laugh:
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
Super Lloyd wrote:
C++ 10000 Milliseconds = 1313
change to 562 Intel 8.0 and MSVC 6.0 You are running twice the time of "last generation's technology." :) shall I load up Intel 9.0 on another machine and make the difference greater? -- modified at 11:47 Tuesday 1st August, 2006
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
Jeffry J. Brickley wrote:
change to 562 Intel 8.0 and MSVC 6.0
Wrong! You should test both program on your computer! because my computer is probably much slower than yours! otherwise you compare my C# version on my PC to you C++ version on your PC. well, all the C++ coder seems afraid to see the truth I could see... ;P
-
I tried to make a C++ project with VS... Obviously I'm not used to.. It doesn't recognize 'vector' :sigh: could anyone do the test? :sigh: (otherwise I could believe you are afraid to see C++ be beaten)
Super Lloyd wrote:
(otherwise I could believe you are afraid to see C++ be beaten)
I already did.... look down.
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
Jeffry J. Brickley wrote:
change to 562 Intel 8.0 and MSVC 6.0
Wrong! You should test both program on your computer! because my computer is probably much slower than yours! otherwise you compare my C# version on my PC to you C++ version on your PC. well, all the C++ coder seems afraid to see the truth I could see... ;P
Super Lloyd wrote:
well, all the C++ coder seems afraid to see the truth I could see...
Not all of us have C# on every machine.... but it was on a 3.0ghz Intel P4. what machine was yours on?
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
Super Lloyd wrote:
C++ 10000 Milliseconds = 1313
change to 562 Intel 8.0 and MSVC 6.0 You are running twice the time of "last generation's technology." :) shall I load up Intel 9.0 on another machine and make the difference greater? -- modified at 11:47 Tuesday 1st August, 2006
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
In case you don't know how to compile C# let's at least compare the computer's spec. I have and AMD Semprom 2800+ 1.61 GHz
-
Super Lloyd wrote:
C++ 10000 Milliseconds = 1313
change to 562 Intel 8.0 and MSVC 6.0 You are running twice the time of "last generation's technology." :) shall I load up Intel 9.0 on another machine and make the difference greater? -- modified at 11:47 Tuesday 1st August, 2006
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
Or he could have a slower PC than you.... ;)
Steve Maier, MCSD MCAD MCTS
-
On another thread some posted this link: http://www.csharphelp.com/archives2/archive458.html[^] Now I was very suprised by this bad C# result, it's not at all what I experience! So I decided to test my self! I have .NET 2 and gcc 3.4.4 I compiled like this: CPP> gcc -O3 -o sieve2.exe sieve.cpp -lstdc++ C#> csc /o+ /nologo /out:sieve.exe Sieve.cs I got: C# 10000 Milliseconds = 1156 C++ 10000 Milliseconds = 1313 Haheum..... what else can I say? -- modified at 11:18 Tuesday 1st August, 2006 I propose a Contest. Post a small C++ performance test program here (less than 200 readable lines). I'll try to beat it with a C# version!
on my machine C# (VS05) : 812 C++ (VC6) : 578 C++ (VS03) : 609 the C++ app won't run on VS05. out of range error in one of the vector iterator hits. default release build settings, for each -- modified at 12:04 Tuesday 1st August, 2006
Why donchoo take a peekchur mayn? OK, cleeeeek
-
Super Lloyd wrote:
well, all the C++ coder seems afraid to see the truth I could see...
Not all of us have C# on every machine.... but it was on a 3.0ghz Intel P4. what machine was yours on?
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
AMD Sempron 2800+ 1.61 GHz No wonder you are twice as fast!
-
on my machine C# (VS05) : 812 C++ (VC6) : 578 C++ (VS03) : 609 the C++ app won't run on VS05. out of range error in one of the vector iterator hits. default release build settings, for each -- modified at 12:04 Tuesday 1st August, 2006
Why donchoo take a peekchur mayn? OK, cleeeeek
Ha... good! okay.....