Has anyone done any performance comparisons? Is there any real difference - especially as they both run of the CLR et al
I am aware of the different coding styles.
Printable View
Has anyone done any performance comparisons? Is there any real difference - especially as they both run of the CLR et al
I am aware of the different coding styles.
My understanding is that 99% of the time there the same because of the CLR. C# can use unsafe code which can make a difference, I don't know too much about it as I'm a VB guy. I believe it's generally not recomended though.
There is nothing unsafe about Unsafe code, despite its name. It has a great deal of power and in some situations can yield performance in excess of 35 times faster than the equivalent VB code (yes I have benchmarked that myself). Admittedly this is only in certain cases, for example a fast inner loop that does a lot of array access.
In generall though there seems to be an approximate 1 - 2% speed advantage to C#. Numerous individual optimisations and syntax quirks make certain operations a bit faster.
Also, if you are a VB6 coder moving to .net I'd advise you to go with C#. Mainly because you will find the transition MUCH easier than going to VB.net. I think this is because the syntax is so different that you won't find your old VB6 knowledge getting in the way and confusing matters.
C# is the best .net language there is, better than VB.net, J# or Managed C++.
If you are at a point where you are flipping a coin to choose between VB.net and C# then I'd say get a double-headed coin and shout "Heads for C#".
I'll never go back to VB ever again, in any of its guises.
However, unmanaged C++ pwns them all, speedwise as well as efficiency. Plus it supports inline assembly. ;)
Which is completely irrelevant since we are not discussing that.Quote:
Originally Posted by Jacob Roman
If the way to get performance is to use the so called 'unsafe' code then isn't it wiser to just write the relevant algorithm in an unmanaged DLL in C/assembly and link in at runtime?
To add a little context to the question - which is always helpful . . .
The sort of development we do is CBSE (Component Based Software Engineering) as opposed to Object Oriented Software Engineering - they rely, architecturally, on different philosophies to achieve reuse, effective change management, and fast development times.
The ideal environment for this style of application development is VB6/COM+ Not because the language syntax is cool, and certainly not because the IDE is particularly helpful.
It's also pretty much a base language; what I mean by that is that no-matter what program language you know, you can pretty much bet that any programmer can get up to speed on VB6 (not necessarily COM+ development) quickly which - as I'm sure you can see a major business advantage.
Now, .Net enforces OOP quite nicely, but it doesn't help (at all) with effective seperation of specification and implementation. Sure you can stick the damn things in different assemblies, with different source files for each instance.
With the old paradigm, you created an IDL file and compiled it with MIDL. You could enforce that seperation across your junior programmers (you must have met them - they're the ones who know more than you ;))
What has this got to do with performance?
Well, in my manager's infinite wisdom, he has decided to go the M$ route, and I've been charged with deciding the language of choice.
As far as I can see all .net is, is a framework for generating object oriented code. Sure, you can get it to do other stuff, but it's quirky, and clunky - relying on good programmer practice rather than enforcing stuff through the environment. All in all, for me, it's a bit of a let down.
Anyway I have to choose a 'business' language. It has to be a M$ implementation (we've pretty bought in so much it'd be very difficult to change) I don't particularly see the real semantic difference between C# and VB.net, the only difference that's obvious to discern is syntax.
So, havng not have played too much with either, the choice looks like it will be down to performance.
I have whittled the choices down to A#,C# and Vb.net. Needless to say A# is my choice and nobody apart from me has ever heard of it so it's currently bottom of the list.
No, because unsafe code is still CLR compliant. Its not unmanaged. :)Quote:
Originally Posted by yrwyddfa
A# who? :DQuote:
Originally Posted by yrwyddfa
OK hows this for a decision maker: C# WILL be easier for old-hand VB programmers to assimilate and migrate to then VB.Net would be.
VB.net conflicts too much with your beloved memories of VB6, like I said earlier its sufficiently alien that you can make a new partition in your brain and drop C# in without your old VB6 knowledge interfering, AND you can always go back to Vb6 without having to re-learn that too.
At least that's my own experience of it. I always find VB6 programming a lot harder than I used to before I did any VB.net coding. This may or may not be a major factor in your choice.
$0.02 :)
A# was developed by the US military for obvious reasons.
I think that your point that C# is sufficiently different from VB6 is a good one. :thumb:
For an analogy, I'm learning ASM at the moment and its not interfering with my knowledge of any other languages. This is because its so different.
I really quite like assembly, but there's absolutely no way it could be used as a business language
I got a good roasting for using assembly for core DLL's when I first started at the company I'm currently at.
They had a point - it would cost them a fortune to get a contractor in to get it fixed should I leave or expire in some other fashion.
So now I haven't used it for years.
Which is a shame.
Thats the problem with some companies, they are dumb. Use the tool for the job I say, no better use for ASM than for heavily used core libs or kernels. To be honest, for me at the moment, ASM is just a toy. I want to learn just enough to get into simple graphics techniques (drawing lines and pixels and text) then just play around with it for a while until have it fixed in my mind then i'll be digging into other areas of the language like file IO and serial port programming (I cant wait for that!!).
Maybe in 10 years I'll build an OS from scratch and overthrow MS :D
I came across this and thought you might find it helpful:
http://www.codeproject.com/dotnet/vb...difference.asp
Cheers :thumb: I sort of all ready knew the syntactical differences, but there's some stuff there that's gonna help.
Incidentally with regards to 'safe mode'
Is the Vb AddressOf function 'Safe mode'?
If you mean code safe, I'm faily sure all VB code is (including addressof)