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. General Programming
  3. Managed C++/CLI
  4. Unexpected performance

Unexpected performance

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++dotnetvisual-studioperformance
29 Posts 4 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.
  • M Mark Salsbery

    gajatko wrote:

    I got 3582 native and 1612 with /clr

    Which numbers are you reporting there? Mark

    Mark Salsbery Microsoft MVP - Visual C++ :java:

    L Offline
    L Offline
    Lutoslaw
    wrote on last edited by
    #5

    start = clock();
    for (int i = 0; i < COUNT; i++) {
    objects[i] = new myClass();
    delete objects[i];
    }
    printf("Native with delete: %f\n", (double)(clock() - start) / CLOCKS_PER_SEC * 1000);

    Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

    M 1 Reply Last reply
    0
    • L Lutoslaw

      start = clock();
      for (int i = 0; i < COUNT; i++) {
      objects[i] = new myClass();
      delete objects[i];
      }
      printf("Native with delete: %f\n", (double)(clock() - start) / CLOCKS_PER_SEC * 1000);

      Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #6

      Try this (and do NOT run in the debugger!)

      class myClass
      {
      };

      int _tmain(int argc, _TCHAR* argv[])
      {
      const int COUNT = 1000000;
      myClass** objects = new myClass*[COUNT];

      clock\_t start1 = clock();
      for (int i = 0; i < COUNT; i++) 
      {
      	objects\[i\] = new myClass();
      	delete objects\[i\];
      }
      clock\_t end1 = clock();
      
      clock\_t start2 = clock();
      for (int i = 0; i < COUNT; i++){
      	objects\[i\] = new myClass();
      }
      clock\_t end2 = clock();
      clock\_t start3 = clock();
      for (int i = 0; i < COUNT; i++){
      	delete objects\[i\];
      }
      clock\_t end3 = clock();
      
      printf("Loop with new/delete: %d\\n\\n", end1 - start1);
      printf("Loop with new: %d\\n", end2 - start2);
      printf("Loop with delete: %d\\n", end3 - start3);
      printf("Total of loop new and loop delete: %d\\n", end3 - start2);
      
      printf("\\n\\nPress enter to end...");
      getchar();
      
      delete\[\] objects;
      
      return 0;
      

      }

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      L L 2 Replies Last reply
      0
      • M Mark Salsbery

        Try this (and do NOT run in the debugger!)

        class myClass
        {
        };

        int _tmain(int argc, _TCHAR* argv[])
        {
        const int COUNT = 1000000;
        myClass** objects = new myClass*[COUNT];

        clock\_t start1 = clock();
        for (int i = 0; i < COUNT; i++) 
        {
        	objects\[i\] = new myClass();
        	delete objects\[i\];
        }
        clock\_t end1 = clock();
        
        clock\_t start2 = clock();
        for (int i = 0; i < COUNT; i++){
        	objects\[i\] = new myClass();
        }
        clock\_t end2 = clock();
        clock\_t start3 = clock();
        for (int i = 0; i < COUNT; i++){
        	delete objects\[i\];
        }
        clock\_t end3 = clock();
        
        printf("Loop with new/delete: %d\\n\\n", end1 - start1);
        printf("Loop with new: %d\\n", end2 - start2);
        printf("Loop with delete: %d\\n", end3 - start3);
        printf("Total of loop new and loop delete: %d\\n", end3 - start2);
        
        printf("\\n\\nPress enter to end...");
        getchar();
        
        delete\[\] objects;
        
        return 0;
        

        }

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #7

        Mark Salsbery wrote:

        Try this (and do NOT run in the debugger!)

        Did you look something like this[^] while typing that in?

        led mike

        M L 2 Replies Last reply
        0
        • L led mike

          Mark Salsbery wrote:

          Try this (and do NOT run in the debugger!)

          Did you look something like this[^] while typing that in?

          led mike

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #8

          LMAO! You betcha! :laugh:

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • M Mark Salsbery

            Try this (and do NOT run in the debugger!)

            class myClass
            {
            };

            int _tmain(int argc, _TCHAR* argv[])
            {
            const int COUNT = 1000000;
            myClass** objects = new myClass*[COUNT];

            clock\_t start1 = clock();
            for (int i = 0; i < COUNT; i++) 
            {
            	objects\[i\] = new myClass();
            	delete objects\[i\];
            }
            clock\_t end1 = clock();
            
            clock\_t start2 = clock();
            for (int i = 0; i < COUNT; i++){
            	objects\[i\] = new myClass();
            }
            clock\_t end2 = clock();
            clock\_t start3 = clock();
            for (int i = 0; i < COUNT; i++){
            	delete objects\[i\];
            }
            clock\_t end3 = clock();
            
            printf("Loop with new/delete: %d\\n\\n", end1 - start1);
            printf("Loop with new: %d\\n", end2 - start2);
            printf("Loop with delete: %d\\n", end3 - start3);
            printf("Total of loop new and loop delete: %d\\n", end3 - start2);
            
            printf("\\n\\nPress enter to end...");
            getchar();
            
            delete\[\] objects;
            
            return 0;
            

            }

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            L Offline
            L Offline
            Lutoslaw
            wrote on last edited by
            #9

            OK so what should I see? I get results: For /clr:

            Loop with new/delete: 174

            Loop with new: 101
            Loop with delete: 77
            Total of loop new and loop delete: 178

            Press enter to end...

            for not /clr:

            Loop with new/delete: 306

            Loop with new: 90
            Loop with delete: 64
            Total of loop new and loop delete: 154

            Press enter to end...

            And I neither run from IDE nor in Debug mode. According to a "you pay as you go" C++ philosophy the result should be the same.

            Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

            M 2 Replies Last reply
            0
            • L led mike

              Mark Salsbery wrote:

              Try this (and do NOT run in the debugger!)

              Did you look something like this[^] while typing that in?

              led mike

              L Offline
              L Offline
              Lutoslaw
              wrote on last edited by
              #10

              Good one! Personally I get used to strange things happening with M$ implementation of Java VM*, so I look like this constantly when programming. Uhm something wrong with logic is here but who cares. Cheers :-D * - ok, just kidding.

              Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

              L 1 Reply Last reply
              0
              • L Lutoslaw

                Any ideas why the following code runs faster (19 vs 37 msec in the first test) with /clr flag on? No clr is used in the code at all!

                #include "stdafx.h"

                class myClass
                {
                };

                int main()
                {
                clock_t start;
                const int COUNT = 100000;
                myClass* objects[COUNT];
                start = clock();
                for (int i = 0; i < COUNT; i++) {
                objects[i] = new myClass();
                delete objects[i];
                }
                printf("Native with delete: %f\n", (double)(clock() - start));

                start = clock();
                for (int i = 0; i < COUNT; i++){
                	objects\[i\] = new myClass();
                }
                clock\_t start2 = clock();
                for (int i = 0; i < COUNT; i++){
                	delete objects\[i\];
                }
                printf("Native without delete: %f\\n", (double)(start2 - start));
                printf("Deletion: %f\\n", (double)(clock() - start2));
                printf("Total: %f\\n", (double)(clock() - start));
                

                }

                Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #11

                I'm not sure what you're expecting here. First, if you were running tests in the debugger, forgetaboutit. Second, comparing times for two sets of loops isn't going to work. Try putting the loop with the new/delete combined below the other two loops and you'll see what I mean. There's alot going on with the heap there, making the results...well, there's no comparison. Third, comparing native to CLR build...the MSIL is better optimized than the debug native code (assuming that's what you were comparing to). Again, no comparison. I would guess, if you figure out the right combination of optimization switches, you MAY be able to make the native version a TINY bit faster than the managed version...maybe... Lastly, don't believe people that say managed code is slower :)

                Mark Salsbery Microsoft MVP - Visual C++ :java:

                L R 2 Replies Last reply
                0
                • L Lutoslaw

                  OK so what should I see? I get results: For /clr:

                  Loop with new/delete: 174

                  Loop with new: 101
                  Loop with delete: 77
                  Total of loop new and loop delete: 178

                  Press enter to end...

                  for not /clr:

                  Loop with new/delete: 306

                  Loop with new: 90
                  Loop with delete: 64
                  Total of loop new and loop delete: 154

                  Press enter to end...

                  And I neither run from IDE nor in Debug mode. According to a "you pay as you go" C++ philosophy the result should be the same.

                  Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #12

                  See here...[^]

                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                  1 Reply Last reply
                  0
                  • L Lutoslaw

                    OK so what should I see? I get results: For /clr:

                    Loop with new/delete: 174

                    Loop with new: 101
                    Loop with delete: 77
                    Total of loop new and loop delete: 178

                    Press enter to end...

                    for not /clr:

                    Loop with new/delete: 306

                    Loop with new: 90
                    Loop with delete: 64
                    Total of loop new and loop delete: 154

                    Press enter to end...

                    And I neither run from IDE nor in Debug mode. According to a "you pay as you go" C++ philosophy the result should be the same.

                    Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                    M Offline
                    M Offline
                    Mark Salsbery
                    wrote on last edited by
                    #13

                    By the way, just curious - what's your test platform (CPU(s)/speed) and compiler version?

                    Mark Salsbery Microsoft MVP - Visual C++ :java:

                    L L 2 Replies Last reply
                    0
                    • M Mark Salsbery

                      By the way, just curious - what's your test platform (CPU(s)/speed) and compiler version?

                      Mark Salsbery Microsoft MVP - Visual C++ :java:

                      L Offline
                      L Offline
                      led mike
                      wrote on last edited by
                      #14

                      Mark Salsbery wrote:

                      and compiler version?

                      Capt. Crunch 3.5

                      led mike

                      M 1 Reply Last reply
                      0
                      • L Lutoslaw

                        Good one! Personally I get used to strange things happening with M$ implementation of Java VM*, so I look like this constantly when programming. Uhm something wrong with logic is here but who cares. Cheers :-D * - ok, just kidding.

                        Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                        L Offline
                        L Offline
                        led mike
                        wrote on last edited by
                        #15

                        gajatko wrote:

                        I get used to strange things happening with M$ implementation of Java VM*

                        Yeah, cause the Sun VM was perfectly stable. :rolleyes:

                        led mike

                        1 Reply Last reply
                        0
                        • M Mark Salsbery

                          By the way, just curious - what's your test platform (CPU(s)/speed) and compiler version?

                          Mark Salsbery Microsoft MVP - Visual C++ :java:

                          L Offline
                          L Offline
                          Lutoslaw
                          wrote on last edited by
                          #16

                          Vista B. x64 SP 1 Intel Quad 2.4, 2 GB RAM, VS 2008

                          Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                          1 Reply Last reply
                          0
                          • M Mark Salsbery

                            I'm not sure what you're expecting here. First, if you were running tests in the debugger, forgetaboutit. Second, comparing times for two sets of loops isn't going to work. Try putting the loop with the new/delete combined below the other two loops and you'll see what I mean. There's alot going on with the heap there, making the results...well, there's no comparison. Third, comparing native to CLR build...the MSIL is better optimized than the debug native code (assuming that's what you were comparing to). Again, no comparison. I would guess, if you figure out the right combination of optimization switches, you MAY be able to make the native version a TINY bit faster than the managed version...maybe... Lastly, don't believe people that say managed code is slower :)

                            Mark Salsbery Microsoft MVP - Visual C++ :java:

                            L Offline
                            L Offline
                            Lutoslaw
                            wrote on last edited by
                            #17

                            Mark Salsbery wrote:

                            I'm not sure what you're expecting here.

                            Not sure what to expect, but definately not this (sounds good).

                            Mark Salsbery wrote:

                            First, if you were running tests in the debugger, forgetaboutit.

                            Hey, I'm not an urgent-codes-plz-gimme-guy and I do not do tests in a debugger!!

                            Mark Salsbery wrote:

                            Second, comparing times for two sets of loops isn't going to work.

                            That was secondary tests. In fact, the first one was important to me (ok, not important. All this talk is neither interesting nor important, but I must figure the thing out).

                            Mark Salsbery wrote:

                            the MSIL is better optimized

                            What could be optimized in such a simple code?

                            Mark Salsbery wrote:

                            Lastly, don't believe people that say managed code is slower

                            Lucky and happy you. The problem is that if you believe something (God, Holy Grail, etc.) you likely believe people as well. Oh sorry I'm getting too soap-boxy.

                            Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                            M 1 Reply Last reply
                            0
                            • L Lutoslaw

                              Mark Salsbery wrote:

                              I'm not sure what you're expecting here.

                              Not sure what to expect, but definately not this (sounds good).

                              Mark Salsbery wrote:

                              First, if you were running tests in the debugger, forgetaboutit.

                              Hey, I'm not an urgent-codes-plz-gimme-guy and I do not do tests in a debugger!!

                              Mark Salsbery wrote:

                              Second, comparing times for two sets of loops isn't going to work.

                              That was secondary tests. In fact, the first one was important to me (ok, not important. All this talk is neither interesting nor important, but I must figure the thing out).

                              Mark Salsbery wrote:

                              the MSIL is better optimized

                              What could be optimized in such a simple code?

                              Mark Salsbery wrote:

                              Lastly, don't believe people that say managed code is slower

                              Lucky and happy you. The problem is that if you believe something (God, Holy Grail, etc.) you likely believe people as well. Oh sorry I'm getting too soap-boxy.

                              Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                              M Offline
                              M Offline
                              Mark Salsbery
                              wrote on last edited by
                              #18

                              gajatko wrote:

                              Not sure what to expect, but definately not this

                              Definitely didn't expect what?

                              gajatko wrote:

                              Lucky and happy you.

                              I have no idea what you mean by that. I didn't state anything about me.

                              gajatko wrote:

                              The problem is that if you believe something (God, Holy Grail, etc.) you likely believe people as well.

                              Not sure what that means either. Just because I believe I'll have another beer doesn't mean I believe people.

                              Mark Salsbery Microsoft MVP - Visual C++ :java:

                              L 1 Reply Last reply
                              0
                              • L led mike

                                Mark Salsbery wrote:

                                and compiler version?

                                Capt. Crunch 3.5

                                led mike

                                M Offline
                                M Offline
                                Mark Salsbery
                                wrote on last edited by
                                #19

                                Heh[^]

                                Mark Salsbery Microsoft MVP - Visual C++ :java:

                                1 Reply Last reply
                                0
                                • M Mark Salsbery

                                  gajatko wrote:

                                  Not sure what to expect, but definately not this

                                  Definitely didn't expect what?

                                  gajatko wrote:

                                  Lucky and happy you.

                                  I have no idea what you mean by that. I didn't state anything about me.

                                  gajatko wrote:

                                  The problem is that if you believe something (God, Holy Grail, etc.) you likely believe people as well.

                                  Not sure what that means either. Just because I believe I'll have another beer doesn't mean I believe people.

                                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                                  L Offline
                                  L Offline
                                  Lutoslaw
                                  wrote on last edited by
                                  #20

                                  It looks like I reached a maximum humour abstraction level last night. Do not take that serious please. :-O :rolleyes:

                                  Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                                  M 1 Reply Last reply
                                  0
                                  • L Lutoslaw

                                    It looks like I reached a maximum humour abstraction level last night. Do not take that serious please. :-O :rolleyes:

                                    Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                                    M Offline
                                    M Offline
                                    Mark Salsbery
                                    wrote on last edited by
                                    #21

                                    No problem :) Cheers :beer:

                                    Mark Salsbery Microsoft MVP - Visual C++ :java:

                                    1 Reply Last reply
                                    0
                                    • M Mark Salsbery

                                      I'm not sure what you're expecting here. First, if you were running tests in the debugger, forgetaboutit. Second, comparing times for two sets of loops isn't going to work. Try putting the loop with the new/delete combined below the other two loops and you'll see what I mean. There's alot going on with the heap there, making the results...well, there's no comparison. Third, comparing native to CLR build...the MSIL is better optimized than the debug native code (assuming that's what you were comparing to). Again, no comparison. I would guess, if you figure out the right combination of optimization switches, you MAY be able to make the native version a TINY bit faster than the managed version...maybe... Lastly, don't believe people that say managed code is slower :)

                                      Mark Salsbery Microsoft MVP - Visual C++ :java:

                                      R Offline
                                      R Offline
                                      Rob Bryce
                                      wrote on last edited by
                                      #22

                                      Mark Salsbery wrote:

                                      Lastly, don't believe people that say managed code is slower

                                      Actually...this is exactly what we're finding. Real world problem: - MFC application, 1 EXE and 5 DLL's. The DLL's do all the computations and are highly optimized C++ code which have been validated for correctness and operation many times in the past decade. And we have spent many late nights finding performance gains - the code is good. The front-end is GUI. We have MFC, STL, ATL technologies incorporated, plus a lot of hand-written code - because STL was too slow. The DLL's implement linear algebra, various geometry calculations, and 1st-order PDE's. There are also simple array/table look-ups. The project is 300,000+ lines code. - we also use ZLIB, GDAL/OGR, CGAL but they aren't used in these tests Test results: - baseline is current release build, test case taks 190seconds. - simply turn on the /clr switch on as many files as possible (following the bouncing ball, trying to do it right) and performance drops to 345 seconds (not all could run managed because of MFC) - retest native release build, it stays the same - concerned we are doing too many native/managed swaps to translate 1 DLL to entirely a C++/CLI classlib, performance drops to 355 seconds. Confused so try it again, 361 seconds - try NGEN on the classlib, performance becomes 349 seconds - try NGEN on the entire project, performance becomes 476 seconds! - back out of changes, start over with the native release build, back around 188 seconds - incorporate the classlib and do MINIMUM required to get things to link back together (to use native as much as possible) and performance is around 244 seconds All other test cases yield similar results. We WANT to move to .Net (to clean up the code, make it easier to maintain and read, etc.), but we need a migratory path where we don't have to rewrite the entire front end out of MFC right away. But these performance #'s just suck. We can't ask the client to live with such poor performance during migration in hopes it will improve when it's all done and running strictly in managed. We have experience with C# in another project but are new in the C++/CLI world. I'd happily discuss this online or offline but 'til then I can't agree with your comment at all Mark! --Rob

                                      M L 2 Replies Last reply
                                      0
                                      • R Rob Bryce

                                        Mark Salsbery wrote:

                                        Lastly, don't believe people that say managed code is slower

                                        Actually...this is exactly what we're finding. Real world problem: - MFC application, 1 EXE and 5 DLL's. The DLL's do all the computations and are highly optimized C++ code which have been validated for correctness and operation many times in the past decade. And we have spent many late nights finding performance gains - the code is good. The front-end is GUI. We have MFC, STL, ATL technologies incorporated, plus a lot of hand-written code - because STL was too slow. The DLL's implement linear algebra, various geometry calculations, and 1st-order PDE's. There are also simple array/table look-ups. The project is 300,000+ lines code. - we also use ZLIB, GDAL/OGR, CGAL but they aren't used in these tests Test results: - baseline is current release build, test case taks 190seconds. - simply turn on the /clr switch on as many files as possible (following the bouncing ball, trying to do it right) and performance drops to 345 seconds (not all could run managed because of MFC) - retest native release build, it stays the same - concerned we are doing too many native/managed swaps to translate 1 DLL to entirely a C++/CLI classlib, performance drops to 355 seconds. Confused so try it again, 361 seconds - try NGEN on the classlib, performance becomes 349 seconds - try NGEN on the entire project, performance becomes 476 seconds! - back out of changes, start over with the native release build, back around 188 seconds - incorporate the classlib and do MINIMUM required to get things to link back together (to use native as much as possible) and performance is around 244 seconds All other test cases yield similar results. We WANT to move to .Net (to clean up the code, make it easier to maintain and read, etc.), but we need a migratory path where we don't have to rewrite the entire front end out of MFC right away. But these performance #'s just suck. We can't ask the client to live with such poor performance during migration in hopes it will improve when it's all done and running strictly in managed. We have experience with C# in another project but are new in the C++/CLI world. I'd happily discuss this online or offline but 'til then I can't agree with your comment at all Mark! --Rob

                                        M Offline
                                        M Offline
                                        Mark Salsbery
                                        wrote on last edited by
                                        #23

                                        Hi Rob, My comment was in the context of the OP. I challenged the OP to optimize his sample to be as fast or faster than the managed version. I also implied he couldn't do it :) Of course highly optimized C++ code is going to be faster - faster than ANY high level language. That's its purpose.

                                        Rob Bryce wrote:

                                        simply turn on the /clr switch on as many files as possible

                                        I certainly wouldn't do that. C++/CLI is meant to be a bridge from native C++ to the managed .NET world. It should be used as that. Use the #pragma managed/#pragma unmanaged macros to control what code gets compiled managed and what stays native. Then you can keep your optimized or performance critical code compiled native. This can be done at the function level! :) Cheers, Mark

                                        Mark Salsbery Microsoft MVP - Visual C++ :java:

                                        R 1 Reply Last reply
                                        0
                                        • R Rob Bryce

                                          Mark Salsbery wrote:

                                          Lastly, don't believe people that say managed code is slower

                                          Actually...this is exactly what we're finding. Real world problem: - MFC application, 1 EXE and 5 DLL's. The DLL's do all the computations and are highly optimized C++ code which have been validated for correctness and operation many times in the past decade. And we have spent many late nights finding performance gains - the code is good. The front-end is GUI. We have MFC, STL, ATL technologies incorporated, plus a lot of hand-written code - because STL was too slow. The DLL's implement linear algebra, various geometry calculations, and 1st-order PDE's. There are also simple array/table look-ups. The project is 300,000+ lines code. - we also use ZLIB, GDAL/OGR, CGAL but they aren't used in these tests Test results: - baseline is current release build, test case taks 190seconds. - simply turn on the /clr switch on as many files as possible (following the bouncing ball, trying to do it right) and performance drops to 345 seconds (not all could run managed because of MFC) - retest native release build, it stays the same - concerned we are doing too many native/managed swaps to translate 1 DLL to entirely a C++/CLI classlib, performance drops to 355 seconds. Confused so try it again, 361 seconds - try NGEN on the classlib, performance becomes 349 seconds - try NGEN on the entire project, performance becomes 476 seconds! - back out of changes, start over with the native release build, back around 188 seconds - incorporate the classlib and do MINIMUM required to get things to link back together (to use native as much as possible) and performance is around 244 seconds All other test cases yield similar results. We WANT to move to .Net (to clean up the code, make it easier to maintain and read, etc.), but we need a migratory path where we don't have to rewrite the entire front end out of MFC right away. But these performance #'s just suck. We can't ask the client to live with such poor performance during migration in hopes it will improve when it's all done and running strictly in managed. We have experience with C# in another project but are new in the C++/CLI world. I'd happily discuss this online or offline but 'til then I can't agree with your comment at all Mark! --Rob

                                          L Offline
                                          L Offline
                                          led mike
                                          wrote on last edited by
                                          #24

                                          Rob Bryce wrote:

                                          We WANT to move to .Net (to clean up the code, make it easier to maintain and read, etc.)

                                          Obviously I don't know your project but that statement certainly raises my eyebrow in general. I am not convinced that the C++ language produces less readable or maintainable code. Furthermore, with the additions of the VS2008 C++ Feature pack including TR1 items, it seems even less likely that the language is a barrier to readable, maintainable and flexible design. In fact I believe the exact opposite is true. Features available only in C++ are the reason e.g., like being able to utilize stack rather than always heap, in my mind simplifies readability. PInvoke is another that comes to mind. X| In any event, I would certainly not agree to migrate to any managed platform based solely on the belief that the resulting code will be intrinsically more readable, maintainable.

                                          led mike

                                          R 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