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
    #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
                  • 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
                    #15

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

                    Steve Maier, MCSD MCAD MCTS

                    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
                      #16

                      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
                        #17

                        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:

                          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
                          #18

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

                          E 2 Replies 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
                            #19

                            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
                            • 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
                              • 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
                                #21

                                Ahem.. Good old article[^]


                                My Blog

                                S 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
                                  #22

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

                                  C 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
                                    • R Rama Krishna Vavilala

                                      Ahem.. Good old article[^]


                                      My Blog

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

                                      Good!

                                      1 Reply Last reply
                                      0
                                      • C Chris Losinger

                                        Super Lloyd wrote:

                                        Is it .NET2??

                                        yes

                                        Why donchoo take a peekchur mayn? OK, cleeeeek

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

                                        Alright, you won! ;)

                                        1 Reply Last reply
                                        0
                                        • S Super Lloyd

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

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

                                          Super Lloyd wrote:

                                          No wonder you are twice as fast!

                                          grumble grumble growl... you made me pull out my 7.2 .net on the laptop, compile, move the application over and run... ;P 1000ms C# 562 Intel C++ Satisfied yet? yes, I moved to release on both, yes, using optimized on both rather than YOUR optimized on one and non on the other....

                                          _________________________ 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
                                          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