Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C# vs. C++ performance [modified] (Contest)

C# vs. C++ performance [modified] (Contest)

Scheduled Pinned Locked Moved The Lounge
csharpc++htmlcss
60 Posts 18 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Chris Losinger

    gcc is not exactly known for the speed of its code. try MSVC or Intel.

    Why donchoo take a peekchur mayn? OK, cleeeeek

    S Offline
    S Offline
    Super Lloyd
    wrote on last edited by
    #4

    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:

    C W G E J 5 Replies Last reply
    0
    • S Super Lloyd

      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:

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #5

      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

      1 Reply Last reply
      0
      • S Super Lloyd

        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:

        W Offline
        W Offline
        WillemM
        wrote on last edited by
        #6

        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?

        1 Reply Last reply
        0
        • C Chris Losinger

          gcc is not exactly known for the speed of its code. try MSVC or Intel.

          Why donchoo take a peekchur mayn? OK, cleeeeek

          S Offline
          S Offline
          Super Lloyd
          wrote on last edited by
          #7

          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)

          E 1 Reply Last reply
          0
          • S Super Lloyd

            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:

            G Offline
            G Offline
            Gary R Wheeler
            wrote on last edited by
            #8

            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;

            Fold With Us![^]

            S 1 Reply Last reply
            0
            • G Gary R Wheeler

              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;

              Fold With Us![^]

              S Offline
              S Offline
              Super Lloyd
              wrote on last edited by
              #9

              Hey, GCC is not so bad! ;P I need some penguin right now! ;P

              E 1 Reply Last reply
              0
              • S Super Lloyd

                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!

                E Offline
                E Offline
                El Corazon
                wrote on last edited by
                #10

                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)

                S S 3 Replies Last reply
                0
                • S Super Lloyd

                  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:

                  E Offline
                  E Offline
                  El Corazon
                  wrote on last edited by
                  #11

                  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)

                  1 Reply Last reply
                  0
                  • S Super Lloyd

                    Hey, GCC is not so bad! ;P I need some penguin right now! ;P

                    E Offline
                    E Offline
                    El Corazon
                    wrote on last edited by
                    #12

                    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)

                    J 1 Reply Last reply
                    0
                    • E El Corazon

                      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)

                      S Offline
                      S Offline
                      Super Lloyd
                      wrote on last edited by
                      #13

                      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

                      E 1 Reply Last reply
                      0
                      • S Super Lloyd

                        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)

                        E Offline
                        E Offline
                        El Corazon
                        wrote on last edited by
                        #14

                        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)

                        1 Reply Last reply
                        0
                        • S Super Lloyd

                          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

                          E Offline
                          E Offline
                          El Corazon
                          wrote on last edited by
                          #15

                          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)

                          S 1 Reply Last reply
                          0
                          • E El Corazon

                            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)

                            S Offline
                            S Offline
                            Super Lloyd
                            wrote on last edited by
                            #16

                            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

                            1 Reply Last reply
                            0
                            • E El Corazon

                              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)

                              S Offline
                              S Offline
                              Steve Maier
                              wrote on last edited by
                              #17

                              Or he could have a slower PC than you.... ;)

                              Steve Maier, MCSD MCAD MCTS

                              1 Reply Last reply
                              0
                              • S Super Lloyd

                                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!

                                C Offline
                                C Offline
                                Chris Losinger
                                wrote on last edited by
                                #18

                                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

                                S 2 Replies Last reply
                                0
                                • E El Corazon

                                  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)

                                  S Offline
                                  S Offline
                                  Super Lloyd
                                  wrote on last edited by
                                  #19

                                  AMD Sempron 2800+ 1.61 GHz No wonder you are twice as fast!

                                  E 2 Replies Last reply
                                  0
                                  • C Chris Losinger

                                    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

                                    S Offline
                                    S Offline
                                    Super Lloyd
                                    wrote on last edited by
                                    #20

                                    Ha... good! okay.....

                                    1 Reply Last reply
                                    0
                                    • C Chris Losinger

                                      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

                                      S Offline
                                      S Offline
                                      Super Lloyd
                                      wrote on last edited by
                                      #21

                                      Is it .NET2?? .NET2 is much better than .NET1 !

                                      C 1 Reply Last reply
                                      0
                                      • S Super Lloyd

                                        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!

                                        R Offline
                                        R Offline
                                        Rama Krishna Vavilala
                                        wrote on last edited by
                                        #22

                                        Ahem.. Good old article[^]


                                        My Blog

                                        S 1 Reply Last reply
                                        0
                                        • S Super Lloyd

                                          Is it .NET2?? .NET2 is much better than .NET1 !

                                          C Offline
                                          C Offline
                                          Chris Losinger
                                          wrote on last edited by
                                          #23

                                          Super Lloyd wrote:

                                          Is it .NET2??

                                          yes

                                          Why donchoo take a peekchur mayn? OK, cleeeeek

                                          S 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups