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.
  • 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
                                  • 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
                                    ClockMeister
                                    wrote on last edited by
                                    #25

                                    Back when processors were slow I might have agreed but C# suits me fine now. -CB :-)

                                    1 Reply Last reply
                                    0
                                    • F Florin Jurcovici

                                      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 Offline
                                      L Offline
                                      Lost User
                                      wrote on last edited by
                                      #26

                                      Florin Jurcovici wrote:

                                      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.

                                      Never believe statistics you have not forged yourself. In this case I would say, that the powerful framework assists you better than the C++ standard libraries. I heard the same from C Win32 C programmers about Win32 assembly programmers. They both used the same API and structured their code in the same way, and the only difference was the language. Comparing C++ with Java or C# and assuming strict object orientation, I don't see much of a difference. On one side I put some thought into the destructors, on the other side I put the same thought into what I do with the finalizer and IDisposable. The code even looks the same, except that I write 'delete Someobject;' instead of 'SomeObject.Dispose();'. And more advanced patterns for managing objects' lifecycles are also not inherently more complicated on either side. The only difference is, that I can't simply let an object go out of scope without deleting it. It's not an optional good practice, it's a must here. To prevent this, I use a simple debugging assertion that reports any remaining objects on the heap when the program terminates and that usually is enough to lead me to the location of the memory leak.

                                      Florin Jurcovici wrote:

                                      Also, the additional speed gained from super-optimized native code doesn't always make a difference.

                                      "But beware of the dark side. Ignorance, lazyness, hastyness; the dark side of the Force are they. Easily they flow, quick to join you in a project. If once you start down the dark path, forever will it dominate your destiny, consume you it will, as it did the Java programmers." Seriously, that kind of argument usually comes from people who could not optimize their code if their lives depended on it. You can take a look at the 'weird and wonderful' forum here to see what kind of things people do when they don't know what they are doing and prefer to leave the dirty work to dumb mechanisms like compilers for code optimization or garbage collection for memory management. Do your statistics also mention the amount of time it takes to clean up the mess such people can produce? Or have you ever seen an entire team of Java programmers struggle with a memory leak for m

                                      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
                                        Fabio Franco
                                        wrote on last edited by
                                        #27

                                        Have you tried doing your heavy calculations in C# unsafe context?

                                        To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                                        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

                                          S Offline
                                          S Offline
                                          SeattleC
                                          wrote on last edited by
                                          #28

                                          Life is too short to await results from Java. If you're not running flat-out 24/7, it's almost not worth coding.

                                          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