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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. My .NET perf studies

My .NET perf studies

Scheduled Pinned Locked Moved The Lounge
c++csharpcomperformance
16 Posts 8 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.
  • R Rama Krishna Vavilala

    I wanted to mail this directly to Shoggy, but I am having some problems. But anyway for the benefit of CP community I am posting it here. The source code available from here uses following methods to calculate prime numbers 1. C# 2. Native C++ 3. Managed C++ with managed code 4. Managed C++ with IJW used to call unmanaged function to do the hard work 5. VB 6. VB.NET All the object implement a single COM interface (Managed ones do with Interop dll) I have two clients :- 1. Managed Client that uses Interop assemblies to talk to Native C++/VB client. 2. Unmanaged Client that uses COM(COM interop). The results which you can see for yourslef after running the app :- 1. The only reason why managed code is slow is (a) JIT compilation (b) Unmanaged-Managed transition 2. Once everything is JIT compiled managed code is almost as fast as unamanged code 3. For some reasons for large prime numbers VB actually out performs C++. 4. You can also repeat the tests as I did by ngen'ing everything and you will see the performance improves. I wish I could write an article about it but I want to include other stuff like IO, data access etc. if I get a time. This is too simple an app currently.

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #2

    Rama Krishna wrote: 2. Once everything is JIT compiled managed code is almost as fast as unamanged code Just in case you want a number with it... I was at some dinky conference a couple of weeks ago and one of the MS guys involved with .NET said it's about 90% as fast as native after it's JITted. But, that's taking his word because I haven't used much .NET yet. Jeremy Falcon Imputek "Great spirits have always found violent opposition from mediocrities. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - Albert Einstein

    R 1 Reply Last reply
    0
    • J Jeremy Falcon

      Rama Krishna wrote: 2. Once everything is JIT compiled managed code is almost as fast as unamanged code Just in case you want a number with it... I was at some dinky conference a couple of weeks ago and one of the MS guys involved with .NET said it's about 90% as fast as native after it's JITted. But, that's taking his word because I haven't used much .NET yet. Jeremy Falcon Imputek "Great spirits have always found violent opposition from mediocrities. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence." - Albert Einstein

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

      My tests show that it varoes from 85%-110%

      M 1 Reply Last reply
      0
      • R Rama Krishna Vavilala

        I wanted to mail this directly to Shoggy, but I am having some problems. But anyway for the benefit of CP community I am posting it here. The source code available from here uses following methods to calculate prime numbers 1. C# 2. Native C++ 3. Managed C++ with managed code 4. Managed C++ with IJW used to call unmanaged function to do the hard work 5. VB 6. VB.NET All the object implement a single COM interface (Managed ones do with Interop dll) I have two clients :- 1. Managed Client that uses Interop assemblies to talk to Native C++/VB client. 2. Unmanaged Client that uses COM(COM interop). The results which you can see for yourslef after running the app :- 1. The only reason why managed code is slow is (a) JIT compilation (b) Unmanaged-Managed transition 2. Once everything is JIT compiled managed code is almost as fast as unamanged code 3. For some reasons for large prime numbers VB actually out performs C++. 4. You can also repeat the tests as I did by ngen'ing everything and you will see the performance improves. I wish I could write an article about it but I want to include other stuff like IO, data access etc. if I get a time. This is too simple an app currently.

        S Offline
        S Offline
        Shog9 0
        wrote on last edited by
        #4

        Interesting... Thanks Rama! :)

        - Shog9 -

        Aaah... It's time to relax. You know what that means: a glass of beer, your favorite ergo chair... And of course, The Code Project loaded on your Personal Computer System. So go on, and indulge yourself, put your feet up. Lean back and just enjoy the articles. After all, CP sooths even the savage :bob:

        R 1 Reply Last reply
        0
        • S Shog9 0

          Interesting... Thanks Rama! :)

          - Shog9 -

          Aaah... It's time to relax. You know what that means: a glass of beer, your favorite ergo chair... And of course, The Code Project loaded on your Personal Computer System. So go on, and indulge yourself, put your feet up. Lean back and just enjoy the articles. After all, CP sooths even the savage :bob:

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

          Just to let you know the only reason why I am not able to post this article is that porting your BallonHelp to .NET is on a higher priority (it is still half finished).:)

          S D 3 Replies Last reply
          0
          • R Rama Krishna Vavilala

            I wanted to mail this directly to Shoggy, but I am having some problems. But anyway for the benefit of CP community I am posting it here. The source code available from here uses following methods to calculate prime numbers 1. C# 2. Native C++ 3. Managed C++ with managed code 4. Managed C++ with IJW used to call unmanaged function to do the hard work 5. VB 6. VB.NET All the object implement a single COM interface (Managed ones do with Interop dll) I have two clients :- 1. Managed Client that uses Interop assemblies to talk to Native C++/VB client. 2. Unmanaged Client that uses COM(COM interop). The results which you can see for yourslef after running the app :- 1. The only reason why managed code is slow is (a) JIT compilation (b) Unmanaged-Managed transition 2. Once everything is JIT compiled managed code is almost as fast as unamanged code 3. For some reasons for large prime numbers VB actually out performs C++. 4. You can also repeat the tests as I did by ngen'ing everything and you will see the performance improves. I wish I could write an article about it but I want to include other stuff like IO, data access etc. if I get a time. This is too simple an app currently.

            E Offline
            E Offline
            Ed K
            wrote on last edited by
            #6

            Any tests against java? We are in a debate here about using C# vs java on a web services project. ed The nice thing about egotists is that they don't talk about other people. Lucille Harper

            R 1 Reply Last reply
            0
            • R Rama Krishna Vavilala

              Just to let you know the only reason why I am not able to post this article is that porting your BallonHelp to .NET is on a higher priority (it is still half finished).:)

              S Offline
              S Offline
              Shog9 0
              wrote on last edited by
              #7

              I appreciate it! Very much looking foreward to seeing what you come up with :)

              - Shog9 -

              Aaah... It's time to relax. You know what that means: a glass of beer, your favorite ergo chair... And of course, The Code Project loaded on your Personal Computer System. So go on, and indulge yourself, put your feet up. Lean back and just enjoy the articles. After all, CP sooths even the savage :bob:

              1 Reply Last reply
              0
              • R Rama Krishna Vavilala

                Just to let you know the only reason why I am not able to post this article is that porting your BallonHelp to .NET is on a higher priority (it is still half finished).:)

                S Offline
                S Offline
                Shog9 0
                wrote on last edited by
                #8

                BTW: Nice nick - had to grab it before kevnar, eh? ;)

                - Shog9 -

                Aaah... It's time to relax. You know what that means: a glass of beer, your favorite ergo chair... And of course, The Code Project loaded on your Personal Computer System. So go on, and indulge yourself, put your feet up. Lean back and just enjoy the articles. After all, CP sooths even the savage :bob:

                1 Reply Last reply
                0
                • E Ed K

                  Any tests against java? We are in a debate here about using C# vs java on a web services project. ed The nice thing about egotists is that they don't talk about other people. Lucille Harper

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

                  Ed K wrote: C# vs java I wish I could do a fair comparison. If you are thinking to windows OS then there is no place for java. I don't think that the sun's VM on windows JIT compiles java byte code. So don't think about java on windows. If you plan to use other OS than it may be justified.

                  J 1 Reply Last reply
                  0
                  • R Rama Krishna Vavilala

                    My tests show that it varoes from 85%-110%

                    M Offline
                    M Offline
                    mstephens
                    wrote on last edited by
                    #10

                    What tests did you do where JIT compiled code ran 10% faster than regular compiled code? Sounds too good to be true!

                    R 1 Reply Last reply
                    0
                    • M mstephens

                      What tests did you do where JIT compiled code ran 10% faster than regular compiled code? Sounds too good to be true!

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

                      Run the my code and make five consequitive calls while calculating 10-100 prime nos. You will find that JIT compiled code runs faster than unmanaged code in third iterstaion onwards.

                      1 Reply Last reply
                      0
                      • R Rama Krishna Vavilala

                        I wanted to mail this directly to Shoggy, but I am having some problems. But anyway for the benefit of CP community I am posting it here. The source code available from here uses following methods to calculate prime numbers 1. C# 2. Native C++ 3. Managed C++ with managed code 4. Managed C++ with IJW used to call unmanaged function to do the hard work 5. VB 6. VB.NET All the object implement a single COM interface (Managed ones do with Interop dll) I have two clients :- 1. Managed Client that uses Interop assemblies to talk to Native C++/VB client. 2. Unmanaged Client that uses COM(COM interop). The results which you can see for yourslef after running the app :- 1. The only reason why managed code is slow is (a) JIT compilation (b) Unmanaged-Managed transition 2. Once everything is JIT compiled managed code is almost as fast as unamanged code 3. For some reasons for large prime numbers VB actually out performs C++. 4. You can also repeat the tests as I did by ngen'ing everything and you will see the performance improves. I wish I could write an article about it but I want to include other stuff like IO, data access etc. if I get a time. This is too simple an app currently.

                        J Offline
                        J Offline
                        Jarek G
                        wrote on last edited by
                        #12

                        Rama Krishna wrote: For some reasons for large prime numbers VB actually out performs C++. One reson can be that C++ code is not optimized enuff? large numbers are better supported in VB than C++. But if you write a good class that can manage large numbers in bit form I think its going to be faster than VB with JIT. Otherwise there must be something wrong. You can say any foolish thing to a dog, and the dog will give you a look that says, My God, you're right I never would've thought of that. * Dave Barry What do you want to patch today?

                        1 Reply Last reply
                        0
                        • R Rama Krishna Vavilala

                          Just to let you know the only reason why I am not able to post this article is that porting your BallonHelp to .NET is on a higher priority (it is still half finished).:)

                          D Offline
                          D Offline
                          David Stone
                          wrote on last edited by
                          #13

                          Woohoo! .NET implementation of Shog's BalloonHelp! Which language is it in? (Please let it be C#...Please let it be C#...) :laugh: David Stone dstone@newcenturytitle.com
                          Procrastination is like masturbation; it's all good until you realize you just screwed yourself. -Writing on a bench at college

                          1 Reply Last reply
                          0
                          • R Rama Krishna Vavilala

                            Ed K wrote: C# vs java I wish I could do a fair comparison. If you are thinking to windows OS then there is no place for java. I don't think that the sun's VM on windows JIT compiles java byte code. So don't think about java on windows. If you plan to use other OS than it may be justified.

                            J Offline
                            J Offline
                            jan larsen
                            wrote on last edited by
                            #14

                            That's not fair, if your'e comparing rich GUI's where Swing is the only alternative then your'e right, but if you can do with good old AWT then I don't think you can get it any faster as the windowing is done using JNI and native peers. "It could have been worse, it could have been ME!" -Rincewind

                            R 1 Reply Last reply
                            0
                            • J jan larsen

                              That's not fair, if your'e comparing rich GUI's where Swing is the only alternative then your'e right, but if you can do with good old AWT then I don't think you can get it any faster as the windowing is done using JNI and native peers. "It could have been worse, it could have been ME!" -Rincewind

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

                              We are not comparing windowing or client apps. The point was about writing a webservice

                              J 1 Reply Last reply
                              0
                              • R Rama Krishna Vavilala

                                We are not comparing windowing or client apps. The point was about writing a webservice

                                J Offline
                                J Offline
                                jan larsen
                                wrote on last edited by
                                #16

                                Oops   :-O , missed that completely. But anyway then: Goldmember wrote: don't think that the sun's VM on windows JIT compiles java byte code Since Java2 (Java 1.2) the default runtime VM is a JIT, HotSpot if i remember correctly, and it is perfectly supported on Windows (actually, it took quite a while before it was available for HP-UX). I haven't seen any performance reviews on any of those WM's but the speed difference is VERY remarkable when comparing GUI apps (though the largest difference is found in the initialization of the VM). When a WM is up and running a non-GUI app though, i don't expect to see that much difference between a pure C# thingy and a pure Java whatnot. Besides: didn't i read once that there was a Visual J#?... J++, hated by slashdot maniacs and other "pure Java" freaks that never discovered the "Do not use microsoft only features" in project settings. "It could have been worse, it could have been ME!" -Rincewind

                                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