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. Man i love C++

Man i love C++

Scheduled Pinned Locked Moved The Lounge
csharpc++androidcomtools
35 Posts 23 Posters 2 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.
  • R RugbyLeague

    I recently rewrote my Compiler/Runtime in C# - it was previously in VC6 - I had expected to take a performance hit but the C# version is faster - sometimes much faster. Which surprised me. I suppose I have much better profiling tools these days than were available 12 years ago so I was able to identify some bottlenecks but nothing I would have thought to make such a difference.

    P Offline
    P Offline
    Pualee
    wrote on last edited by
    #5

    Are your time comparisons on the same machine? Or is your VC6 benchmark on a 10 year old computer? :-D

    R A 2 Replies Last reply
    0
    • E Ennis Ray Lynch Jr

      Native. I am only testing a "small" subset of data right now. IRL, I should several order of magnitudes more data and it still needs to be real-time-ish. 500ms in C# was too slow so I am trying C++ with all optimizations on, after I get this down the next step is moving it to CUDA (if installed) Surprisingly the code is really simple just a lot of multiplication.

      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

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

      Have you tried SSE intrinsics?

      E 1 Reply Last reply
      0
      • P Pualee

        Are your time comparisons on the same machine? Or is your VC6 benchmark on a 10 year old computer? :-D

        R Offline
        R Offline
        RugbyLeague
        wrote on last edited by
        #7

        That's what my boss asked me too. I gave her a withering glare (she is my wife so is used to such glares)

        1 Reply Last reply
        0
        • E Ennis Ray Lynch Jr

          Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

          Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

          Mike HankeyM Offline
          Mike HankeyM Offline
          Mike Hankey
          wrote on last edited by
          #8

          I am refactoring a C++ collection class I wrote some time back for embedded systems and am really enjoying working with it again. Of course in my case I'm not as concerned with speed as I am with space.

          VS2010/Atmel Studio 6.0 ToDo Manager Extension
          Version 3.0 now available. There is no place like 127.0.0.1

          1 Reply Last reply
          0
          • E Ennis Ray Lynch Jr

            Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

            Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #9

            Back in the late 80's/early 90's, I was working in Turbo Pascal on an estate planning application which was performing hundreds of thousands of tax calculations 10's of thousands of times. To say it was slow would be overly kind to the original programmer. I rewrote the code to only need about 20 calculations thousands of times. Generating the resulting charts went from taking about 30 seconds to less than two. When we moved to C++, it was reduced to less than one.

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            "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

            1 Reply Last reply
            0
            • L Lost User

              Have you tried SSE intrinsics?

              E Offline
              E Offline
              Ennis Ray Lynch Jr
              wrote on last edited by
              #10

              I enabled those as a compiler option but other than that I haven't done anything with them (that made a big difference though). Really, I just want a way to justify doing cuda programming : )

              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

              1 Reply Last reply
              0
              • E Ennis Ray Lynch Jr

                Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

                Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                K Offline
                K Offline
                Kevin Marois
                wrote on last edited by
                #11

                Life is too short to code in C++

                If it's not broken, fix it until it is

                L S 2 Replies Last reply
                0
                • E Ennis Ray Lynch Jr

                  Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

                  Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

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

                  Interesting usually I have found that once code is JITed repeated code takes almost the same time in managed/native. Obviously it all depends!

                  1 Reply Last reply
                  0
                  • E Ennis Ray Lynch Jr

                    Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

                    Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                    C Offline
                    C Offline
                    Colin Mullikin
                    wrote on last edited by
                    #13

                    Would you say you like your programming languages the same way you like your women...? Fast and unsafe... :laugh:

                    The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

                    A J 2 Replies Last reply
                    0
                    • C Colin Mullikin

                      Would you say you like your programming languages the same way you like your women...? Fast and unsafe... :laugh:

                      The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

                      A Offline
                      A Offline
                      Albert Holguin
                      wrote on last edited by
                      #14

                      You know... if I had a dime for every time a Java app has crashed my phone... it would have paid for itself by now...

                      E 1 Reply Last reply
                      0
                      • K Kevin Marois

                        Life is too short to code in C++

                        If it's not broken, fix it until it is

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

                        I hope you mean to say that some people need more than a lifetime to understand it and should look for an easier job, like in the fast food industry. :)

                        E F E 3 Replies Last reply
                        0
                        • E Ennis Ray Lynch Jr

                          Native. I am only testing a "small" subset of data right now. IRL, I should several order of magnitudes more data and it still needs to be real-time-ish. 500ms in C# was too slow so I am trying C++ with all optimizations on, after I get this down the next step is moving it to CUDA (if installed) Surprisingly the code is really simple just a lot of multiplication.

                          Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                          E Offline
                          E Offline
                          Espen Harlinn
                          wrote on last edited by
                          #16

                          Play around with Auto-Parallelization and Auto-Vectorization[^] I've been able to get some amazing results, with little effort.

                          Espen Harlinn Principal Architect, Software - Goodtech Projects & Services AS Projects promoting programming in "natural language" are intrinsically doomed to fail. Edsger W.Dijkstra

                          1 Reply Last reply
                          0
                          • L Lost User

                            I hope you mean to say that some people need more than a lifetime to understand it and should look for an easier job, like in the fast food industry. :)

                            E Offline
                            E Offline
                            Espen Harlinn
                            wrote on last edited by
                            #17

                            @@@@@@@@@@@@@@@@@@@@@#+'''''+#@@@@@@@@@@@@@@@@@@@@
                            @@@@@@@@@@@@@@@@@+;;;;;;;;;;;;;;'#@@@@@@@@@@@@@@@@
                            @@@@@@@@@@@@@@#';;;;;;;;;;;;;;;;;;;+@@@@@@@@@@@@@@
                            @@@@@@@@@@@@@';;;;;;;;;;;;;;;;;;;;;;;+@@@@@@@@@@@@
                            @@@@@@@@@@@';;;;;;;;:::::,,,:;;;;;;;;;;#@@@@@@@@@@
                            @@@@@@@@@@;;;;;;;;::::::::,,,;;;;;;;;;;;+@@@@@@@@@
                            @@@@@@@@#;;;;;;;:::::::::::,,;;;;;;;;;;;;'@@@@@@@@
                            @@@@@@@#;;;;;;::::::::::::::;;;;;;;;;;;;;;'@@@@@@@
                            @@@@@@#;;;;;;;:::::::;;;;;;;;;;;;;;;;;;;;;;'@@@@@@
                            @@@@@@;;;;;;;;;:::;;;;;;;;;;::,,,,....;;;;;;'@@@@@
                            @@@@@;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;#@@@@
                            @@@@+;;;;;;;;;;;;;;;;;;;;;;;, `;;;;;;;@@@@
                            @@@@;;;;;;;;;;;;;;;;;;;;;;;;; ``;;;;;;;'@@@
                            @@@';;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;#@@
                            @@@;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;; ,;'@@
                            @@';;;;;;;;;;;;;;;;;;;;;;;;;;, ,;;;;;;;;. ,;;@@
                            @@;;;;;;;;;;;;;` ;;;;;;;;;;;;; `;;;;; .;;'@
                            @+;;;;;;;;;;;;; ;;;;;;; ;; ,;;; .;;;@
                            @;;;;;;;;;;;;;; ,;. `; ;` .;;` .;''@
                            @;;;;;;;,,;;;;; ; :: ;;` ., ,;;, ;;; `;''+
                            @;;;;;; `;;;;;, ; ;. :.` ;;;;;;;, ;; `''''
                            #;;;;` .;` ;; : ;, ;;;;;;;; ;;;'''''
                            +;;, `;, ; ;; .:;;;;;;;;;;;` ;; ;'''
                            '; ;; ,, , ; ;;; ;;;;;;;; ;: `'''
                            '; ` ,; ;;. `, ; `; ;;;;;;;; '' :'''
                            '; ;; `;;: ; ;, `; .;; :;;. ''''''''
                            ';;;; ;; ;: ; .;` .;;;;;;;; .''''''''
                            +;;;; ; :;` : .;;;;;;;;;;;;. '''''''''
                            +;;;; ; `. .;;;;;;;;;;;;;;;; ;'''''''''
                            #;;;;. : `:;;;;;;;;;;;;;;;;;; .'''''''''''
                            @;;;;: .; `;;;;;;;;;;;;;;;;;;;;;;''''''''''''''+
                            @;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;'''''''''''''''#
                            @';;;; `;;;;;;;;;;;;;;;;;;;;;;;;''''''''''''''''@
                            @@;;;; :;;;;;;;;;;;;;;;;;;;;;;;;'''''''''''''''''@
                            @@;;;;;;;;;;;;;;;;;;;;;;;;;;;;;'''''''''''''''''#@
                            @@+;;;;;;;;;;;;;;;;;;;;;;;;;;;''''''''''''''''''@@
                            @@@;;;;;;;;;;;;;;;;;;;;;;;;;;''''''''''';''''''+@@
                            @@@+;;;;;;;;;;;;;;;;;;;;;;;;''''''''''';;''''''@@@
                            @@@@;;;;;;;;;;;;;;;;;;;;;;;''''''''''';;;'''''#@@@
                            @@@@@;;;;;;;;;;;;;;;;;;;;;''''''''''';;;;''''+@@@@
                            @@@@@+;;;;;;;;;;;;;;;;;;;'''''''''';;;;;;''''@@@@@
                            @@@@@@';;;;;;;;;;;;;;;;;''''''''':::;;;;''''@@@@@@
                            @@@@@@@';;;;;;;;;;:::;;;''''';:.,,::;;;''''@@@@@@@
                            @@@@@@@@';;;;;;;;;:::,,.` ``.,,::;;''''@@@@@@@@
                            @@@@@@@@@+;;;;;;;;:::,,.` ``.,,::'''''@@@@@@@@@
                            @@@@@@@@@@#;;;;;;;:::,,.` ``.,,;''''+@@@@@@@@@@
                            @@@@@@@@@@@@';;;;;;;:,,.` `.:''''''#@@@@@@@@@@@
                            @@@@@@@@@@@@@@';;;''''''''''''''''''#@@@@@@@@@@@@@
                            @@@@@@@@@@@@@@@@''''''''''

                            1 Reply Last reply
                            0
                            • E Ennis Ray Lynch Jr

                              Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

                              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                              S Offline
                              S Offline
                              Shao Voon Wong
                              wrote on last edited by
                              #18

                              Kind of unfair comparison, I must say, since P/Invoke has its own overhead. One way to reduce the number of P/Invoke calls, is to batch all the native operations in a C++/CLI method (to lessen the cost of managed-to-native transition).

                              1 Reply Last reply
                              0
                              • E Ennis Ray Lynch Jr

                                Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

                                Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                                J Offline
                                J Offline
                                Joezer BH
                                wrote on last edited by
                                #19

                                :confused:

                                Tzumer

                                F 1 Reply Last reply
                                0
                                • L Lost User

                                  I hope you mean to say that some people need more than a lifetime to understand it and should look for an easier job, like in the fast food industry. :)

                                  F Offline
                                  F Offline
                                  Florin Jurcovici
                                  wrote on last edited by
                                  #20

                                  I think he meant what he said. Statistical evidence says you're twice as fast, on average, when using a language with managed memory. I think Joel Spolsky or Fowler, can't remember exactly who, said this about themselves too. It's my experience too. Also, the additional speed gained from super-optimized native code doesn't always make a difference. Plus, statistical analysis has shown that at least memory management is faster and requires less CPU cycles with managed memory than when doing all memory management manually (at the expense of a three to five times higher memory usage, on average - but I'd trade memory for CPU any time of the day, since fast CPUs are expensive whereas memory nowadays is cheap).

                                  L 1 Reply Last reply
                                  0
                                  • E Ennis Ray Lynch Jr

                                    Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

                                    Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                                    F Offline
                                    F Offline
                                    Florin Jurcovici
                                    wrote on last edited by
                                    #21

                                    It's more of an intense love/hate relation for me. C comes in handy when you absolutely need the speed, but don't have a huge model to implement. Java/C# come in handy when you need to develop and maintain code with minimal cost. When you need both - which is in itself a PITA - C++ is the only alternative. But it sort of adds to the PITA. Its only advantage is that there's not really anything else able to do the job.

                                    1 Reply Last reply
                                    0
                                    • J Joezer BH

                                      :confused:

                                      Tzumer

                                      F Offline
                                      F Offline
                                      Frans_55129
                                      wrote on last edited by
                                      #22

                                      Pascal, Python y Ada.

                                      1 Reply Last reply
                                      0
                                      • E Ennis Ray Lynch Jr

                                        Yes I just might marry it. Forgot how fast it was. In C# I was happy with 500 milliseconds, now I am down to 15 (this is btw, with a P/Invoke call in the middle). Since I am only performing about 500 milling double multiplications I should be able get it to go even faster.

                                        Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                                        J Offline
                                        J Offline
                                        john morrison leon
                                        wrote on last edited by
                                        #23

                                        The only time I use a language other than C++ is when it gives access to a library which isn't available in C++, even then I often generate the code with C+++. C++ does everything I need and I am comfortable and fast with it. Why should I use another language?

                                        E 1 Reply Last reply
                                        0
                                        • P Pualee

                                          Are your time comparisons on the same machine? Or is your VC6 benchmark on a 10 year old computer? :-D

                                          A Offline
                                          A Offline
                                          Aswin Waiba
                                          wrote on last edited by
                                          #24

                                          :thumbsup::thumbsup::thumbsup:

                                          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