My .NET perf studies
-
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.
-
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.
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
-
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
My tests show that it varoes from 85%-110%
-
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.
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:
-
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:
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).:)
-
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.
-
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).:)
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:
-
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).:)
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:
-
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
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.
-
My tests show that it varoes from 85%-110%
-
What tests did you do where JIT compiled code ran 10% faster than regular compiled code? Sounds too good to be true!
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.
-
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.
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?
-
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).:)
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 -
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.
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
-
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
We are not comparing windowing or client apps. The point was about writing a webservice
-
We are not comparing windowing or client apps. The point was about writing a webservice
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