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. .NET 4 Rocks!

.NET 4 Rocks!

Scheduled Pinned Locked Moved The Lounge
csharpcssperformancelounge
52 Posts 26 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.
  • F federico strati

    never underestimate the powers of pure C++ ... in general 40 to 50 % faster than any runtime.

    N Offline
    N Offline
    Nagy Vilmos
    wrote on last edited by
    #11

    In a lot of usages, pure speed is not the only deciding factor. Assuming your ascertation is more than simple hypothesis, let us consider for one moment the advantages of ‘slower’ managed code. 0. Memory is, on the whole, MANAGED for you. Thus the reliance on the coder getting it right is removed. BIG bonus time. 1. Development time is, I am sorry to say, quicker using C# [for example] than C++ 2. Developers are cheaper for modern managed languages over older unmanaged platforms. So, from these simple three points you can see why managed not-det environment is preferred. The customer – that’s the guy paying for the work – get’s more bangs for their buck and doesn’t notice that the response is 200ms against 120ms. To clarify my position, we use TCL scripting, C#, C++ and Java all in one huge big mofu application. Depending on what is being done, different tools are chosen for different jobs. For desktop UI, C# rocks. For processing 10 kt/m C++ is great. For site modifiable interactions and configuration TCL is the Daddy. To keep the Hippies happy Java is the way man.


    Panic, Chaos, Destruction. My work here is done. or "Drink. Get drunk. Fall over." - P O'H

    C M 2 Replies Last reply
    0
    • F federico strati

      never underestimate the powers of pure C++ ... in general 40 to 50 % faster than any runtime.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #12

      Granted, 'managed' means some additional overhead which good old C or C++ avoid. But 40 - 50 %? First you must take a look at your program and identify the parts where the CPU is really put to work. And already 90% or more of your code have become totally uninteresting. After identifying the critical parts of your program, you need to take a good look at your algorithms at those locations. A poorly chosen algorithm can kill the performance, totally independent of the programming language, the optimizations the compiler may perform or the capabilities of the actual hardware. In C++ it has become unusual to optimize the code for a certain hardware. Nowadays there are just too many different CPUs, so you can't really know what awaits your program at runtime. Managed applications may actually have an advantage here since they are compiled just before execution. So where is this guaranteed performance boost in C++ supposed to come from? P.S: I still like working in C++ and also have done a bit of optimizing there, but I simply don't see that vast advantage in performance. You have to work hard to get it and with similar treatment a managed language may produce similar results.

      A while ago he asked me what he should have printed on my business cards. I said 'Wizard'. I read books which nobody else understand. Then I do something which nobody understands. After that the computer does something which nobody understands. When asked, I say things about the results which nobody understand. But everybody expects miracles from me on a regular basis. Looks to me like the classical definition of a wizard.

      1 Reply Last reply
      0
      • F federico strati

        never underestimate the powers of pure C++ ... in general 40 to 50 % faster than any runtime.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #13

        federico.strati wrote:

        never underestimate the powers of pure C++ ... in general 40 to 50 % faster than any runtime.

        Yep. Add in a decent compiler and a decent OS and there is no contest at all.

        1 Reply Last reply
        0
        • H hairy_hats

          Will this[^] do? C# on Windows .NET versus GNU C++ on Linux seems to give the biggest difference.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #14

          Not really no - it goes part of the way, but I'd like to see it with .NET 4 which is much better performing than 3.5 due to the leaner client framework. Certainly, on Windows the difference between C# and Visual C++ is nowhere near the 40-50% difference claimed by the OP.

          I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Onyx

          H 1 Reply Last reply
          0
          • H hairy_hats

            Will this[^] do? C# on Windows .NET versus GNU C++ on Linux seems to give the biggest difference.

            S Offline
            S Offline
            Simon P Stevens
            wrote on last edited by
            #15

            Thanks, very interesting data. On Windows "C++ is %15.8 faster than .Net" On Linux "C++ is 22.% faster than Java" [Remember these are benchmarks over very specific high CPU usage problem sets. These are not general statements] Not quite the 40-50% originally said, but certainly interesting none the less. I'd be really interested to see the same tests repeated with .net 4.

            Simon

            1 Reply Last reply
            0
            • F federico strati

              Exactly what I thought... it is the beginning of a flame war... Anyway, managed code is inherently slower than unmanaged. You got other benefits, like platform indipendence and so on... Too tired to present an example, but I suspect serialisation would be an excellent candidate.

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #16

              federico.strati wrote:

              Exactly what I thought... it is the beginning of a flame war...

              No, it's not. You made an unsubstantiated comment - I'd be more inclined to listen if you actually backed it up rather than making a random statement and then run off when challenged to provide proof. Don't present anecdotal evidence - be empirical. I just get sick and tired of language zealots claiming that language A is better in than language B without offering any qualifying evidence.

              I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

              N S 2 Replies Last reply
              0
              • H hairy_hats

                Will this[^] do? C# on Windows .NET versus GNU C++ on Linux seems to give the biggest difference.

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #17

                I'm more interested that it divides opinion, as the inbound link here[^] shows.

                I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                1 Reply Last reply
                0
                • H hairy_hats

                  Will this[^] do? C# on Windows .NET versus GNU C++ on Linux seems to give the biggest difference.

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

                  The test should be done against .NET4, which is way faster than .NET3, whereas C++ is only a little bit faster than .NET3! ;)

                  A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                  H P 2 Replies Last reply
                  0
                  • P Pete OHanlon

                    federico.strati wrote:

                    Exactly what I thought... it is the beginning of a flame war...

                    No, it's not. You made an unsubstantiated comment - I'd be more inclined to listen if you actually backed it up rather than making a random statement and then run off when challenged to provide proof. Don't present anecdotal evidence - be empirical. I just get sick and tired of language zealots claiming that language A is better in than language B without offering any qualifying evidence.

                    I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Onyx

                    N Offline
                    N Offline
                    Nagy Vilmos
                    wrote on last edited by
                    #19

                    Pete O'Hanlon wrote:

                    I just get sick and tired of language zealots claiming that 0 is better in than 1 without offering any qualifying evidence

                    ftfy


                    Panic, Chaos, Destruction. My work here is done. or "Drink. Get drunk. Fall over." - P O'H

                    H 1 Reply Last reply
                    0
                    • P Pete OHanlon

                      Not really no - it goes part of the way, but I'd like to see it with .NET 4 which is much better performing than 3.5 due to the leaner client framework. Certainly, on Windows the difference between C# and Visual C++ is nowhere near the 40-50% difference claimed by the OP.

                      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Onyx

                      H Offline
                      H Offline
                      hairy_hats
                      wrote on last edited by
                      #20

                      It's interesting that Mono appears to be quicker than .NET - 3.5 at least.

                      1 Reply Last reply
                      0
                      • F federico strati

                        Exactly what I thought... it is the beginning of a flame war... Anyway, managed code is inherently slower than unmanaged. You got other benefits, like platform indipendence and so on... Too tired to present an example, but I suspect serialisation would be an excellent candidate.

                        H Offline
                        H Offline
                        hairy_hats
                        wrote on last edited by
                        #21

                        federico.strati wrote:

                        Anyway, managed code is inherently slower than unmanaged.

                        Depends. If the code is doing a large amount of memory allocation and deallocation, managed can be faster because it can leave the deallocation until later, whereas the unmanaged does it right away.

                        1 Reply Last reply
                        0
                        • N Nagy Vilmos

                          In a lot of usages, pure speed is not the only deciding factor. Assuming your ascertation is more than simple hypothesis, let us consider for one moment the advantages of ‘slower’ managed code. 0. Memory is, on the whole, MANAGED for you. Thus the reliance on the coder getting it right is removed. BIG bonus time. 1. Development time is, I am sorry to say, quicker using C# [for example] than C++ 2. Developers are cheaper for modern managed languages over older unmanaged platforms. So, from these simple three points you can see why managed not-det environment is preferred. The customer – that’s the guy paying for the work – get’s more bangs for their buck and doesn’t notice that the response is 200ms against 120ms. To clarify my position, we use TCL scripting, C#, C++ and Java all in one huge big mofu application. Depending on what is being done, different tools are chosen for different jobs. For desktop UI, C# rocks. For processing 10 kt/m C++ is great. For site modifiable interactions and configuration TCL is the Daddy. To keep the Hippies happy Java is the way man.


                          Panic, Chaos, Destruction. My work here is done. or "Drink. Get drunk. Fall over." - P O'H

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

                          Nagy Vilmos wrote:

                          0. Memory is, on the whole, MANAGED for you. Thus the reliance on the coder getting it right is removed. BIG bonus time.

                          there are enough smart ptr / container classes out there that no C++ programmer should have to worry about explicit memory management, if he/she doesn't want to.

                          Nagy Vilmos wrote:

                          1. Development time is, I am sorry to say, quicker using C# [for example] than C++

                          only because the .Net framework has so much built-in. as a language, C# isn't a great improvement. and with each new version it becomes more and more obtuse. and yes, you can avoid things like LINQ and anonymous delegates and nullable variables, but you can also avoid the ugly parts of C++.

                          Nagy Vilmos wrote:

                          2. Developers are cheaper for modern managed languages over older unmanaged platforms.

                          not if you want the job done correctly.

                          image processing toolkits | batch image processing

                          K 1 Reply Last reply
                          0
                          • N Nagy Vilmos

                            Pete O'Hanlon wrote:

                            I just get sick and tired of language zealots claiming that 0 is better in than 1 without offering any qualifying evidence

                            ftfy


                            Panic, Chaos, Destruction. My work here is done. or "Drink. Get drunk. Fall over." - P O'H

                            H Offline
                            H Offline
                            hairy_hats
                            wrote on last edited by
                            #23

                            Exactly! 1 is much better than 0.

                            1 Reply Last reply
                            0
                            • F federico strati

                              Exactly what I thought... it is the beginning of a flame war... Anyway, managed code is inherently slower than unmanaged. You got other benefits, like platform indipendence and so on... Too tired to present an example, but I suspect serialisation would be an excellent candidate.

                              K Offline
                              K Offline
                              Kevin McFarlane
                              wrote on last edited by
                              #24

                              federico.strati wrote:

                              Anyway, managed code is inherently slower than unmanaged. You got other benefits, like platform indipendence and so on...

                              Look, these kinds of statement are almost meaningless. The overarching strategy is to consider the nature of your business problem and then choose the appropriate tool(s) for the problem(s) at hand. Raw execution speed is just one criterion. Also factors such as ease of design and expressiveness can enable performance improvements over closer-to-the-metal languages. I remember being told at one interview that a port of their app. from C++ to C# increased app. performance. I also know of a case study with Eiffel (a "managed" language) where a port from C to Eiffel resulted in way greater performance due to ease of design and expressiveness.

                              Kevin

                              A 1 Reply Last reply
                              0
                              • C Chris Losinger

                                Nagy Vilmos wrote:

                                0. Memory is, on the whole, MANAGED for you. Thus the reliance on the coder getting it right is removed. BIG bonus time.

                                there are enough smart ptr / container classes out there that no C++ programmer should have to worry about explicit memory management, if he/she doesn't want to.

                                Nagy Vilmos wrote:

                                1. Development time is, I am sorry to say, quicker using C# [for example] than C++

                                only because the .Net framework has so much built-in. as a language, C# isn't a great improvement. and with each new version it becomes more and more obtuse. and yes, you can avoid things like LINQ and anonymous delegates and nullable variables, but you can also avoid the ugly parts of C++.

                                Nagy Vilmos wrote:

                                2. Developers are cheaper for modern managed languages over older unmanaged platforms.

                                not if you want the job done correctly.

                                image processing toolkits | batch image processing

                                K Offline
                                K Offline
                                Kevin McFarlane
                                wrote on last edited by
                                #25

                                Chris Losinger wrote:

                                not if you want the job done correctly.

                                I've worked in both C++ and .NET and I've not seen any greater dev ability in C++ compared to C#. I agree that C++ done well is fine but my experience was that most actual C++ was a mishmash of sloppy low-level C techniques combined with occasional high-level abstractions. Given that reality I much prefer being in the .NET environment.

                                Chris Losinger wrote:

                                you can avoid things like LINQ and anonymous delegates and nullable variables

                                Actually, these features enable more concise and more expressive code.

                                Kevin

                                C L 2 Replies Last reply
                                0
                                • P Pete OHanlon

                                  You make a statement like that, you've got to be able to prove it. Go on, back it up.

                                  I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

                                  Forgive your enemies - it messes with their heads

                                  My blog | My articles | MoXAML PowerToys | Onyx

                                  R Offline
                                  R Offline
                                  realJSOP
                                  wrote on last edited by
                                  #26

                                  He's new, and obviously isn't aware that anything he says will need facts in order to establish an acceptable amount of veracity.

                                  .45 ACP - because shooting twice is just silly
                                  -----
                                  "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                                  -----
                                  "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

                                  1 Reply Last reply
                                  0
                                  • K Kevin McFarlane

                                    Chris Losinger wrote:

                                    not if you want the job done correctly.

                                    I've worked in both C++ and .NET and I've not seen any greater dev ability in C++ compared to C#. I agree that C++ done well is fine but my experience was that most actual C++ was a mishmash of sloppy low-level C techniques combined with occasional high-level abstractions. Given that reality I much prefer being in the .NET environment.

                                    Chris Losinger wrote:

                                    you can avoid things like LINQ and anonymous delegates and nullable variables

                                    Actually, these features enable more concise and more expressive code.

                                    Kevin

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

                                    Kevin McFarlane wrote:

                                    I've worked in both C++ and .NET and I've not seen any greater dev ability in C++ compared to C#.

                                    true; i don't think C++ development is necessarily better or faster. but i know i find myself wishing C# had some of C++'s features (and vice versa) whenever i switch from one to the other. the .Net framework is undeniably a wonderful toolbox, though. that's what makes C# seem more efficient, IMO. it's not that C#'s language constructs are all that great, it's that all the utility classes are right there.

                                    Kevin McFarlane wrote:

                                    Actually, these features enable more concise and more expressive code.

                                    maybe, but they are ugly and cryptic - attributes C++ haters like to use against it.

                                    image processing toolkits | batch image processing

                                    K 1 Reply Last reply
                                    0
                                    • C Chris Losinger

                                      Kevin McFarlane wrote:

                                      I've worked in both C++ and .NET and I've not seen any greater dev ability in C++ compared to C#.

                                      true; i don't think C++ development is necessarily better or faster. but i know i find myself wishing C# had some of C++'s features (and vice versa) whenever i switch from one to the other. the .Net framework is undeniably a wonderful toolbox, though. that's what makes C# seem more efficient, IMO. it's not that C#'s language constructs are all that great, it's that all the utility classes are right there.

                                      Kevin McFarlane wrote:

                                      Actually, these features enable more concise and more expressive code.

                                      maybe, but they are ugly and cryptic - attributes C++ haters like to use against it.

                                      image processing toolkits | batch image processing

                                      K Offline
                                      K Offline
                                      Kevin McFarlane
                                      wrote on last edited by
                                      #28

                                      Chris Losinger wrote:

                                      true; i don't think there's much difference. and i know i find myself wishing C# had some of C++'s features (and vice versa) whenever i switch from one to the other.

                                      OK, so I don't think we're so far apart. :)

                                      Chris Losinger wrote:

                                      the .Net framework is undeniably a wonderful toolbox, though. that's what makes C# seem more efficient, IMO

                                      True, but who cares? I just care that I'm more productive in the C# environment than I am in C++. There's also the IDE factor as well.

                                      Chris Losinger wrote:

                                      maybe, but they are ugly and cryptic

                                      Strange. I don't think so. I think it's more the C++ ones that are ugly and cryptic. OTOH, I've not done any C++ for nearly five years so perhaps my views are coloured. Some of it is down to familiarity. F# looks cryptic to me. But for functional programming gurus C#, C++ etc. look ugly and verbose.

                                      Kevin

                                      1 Reply Last reply
                                      0
                                      • S Super Lloyd

                                        The test should be done against .NET4, which is way faster than .NET3, whereas C++ is only a little bit faster than .NET3! ;)

                                        A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                                        H Offline
                                        H Offline
                                        hairy_hats
                                        wrote on last edited by
                                        #29

                                        Are you saying that they should have tested it against a version of .NET which hadn't been released when they ran the tests?

                                        S 1 Reply Last reply
                                        0
                                        • H hairy_hats

                                          Are you saying that they should have tested it against a version of .NET which hadn't been released when they ran the tests?

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

                                          No, I mean they should update their post! ;P

                                          A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.

                                          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