Is c # slower than c ++? Actually I am a little familiar with c and java ... now I am in a mood to learn c #. Is it better than c and java?

Recommended Answers

All 4 Replies

hi everyone,
From what i gather from other websites about C# is that it slower than
c/c++ because it uses a runtime and sdk to intrepret its codings just like java.

C# is actually a cross between vb and c++ but it is not as mature as java which has been around for a long time. C# is also not platform dependent at the moment and c# was actually created to counter the popularity of java.

But the slowness is hardly noticable if you running single threads but if you are running multiple threads then the slowness is actually quite noticable.
If you are using win 2000 and above you can try downloading sharpdevelop
or mono develop. Both are under the gpl.

For myself i actually like to do bare bones programming

Yours Sincerely

Richard West

Thanks Richard .. I assume that I should not learn c# by now ... I'll do my project in java.

Playing devil's advocate for a moment....

You asked first if C# was FASTER, but then you asked "Is it better than c and java?"

So, I suppose the age old question is, better for WHAT? C# is designed to more easily deal with COM objects than C++, and so if you are doing a project with a bunch of COM objects you could argue that C# is better than C++.

Speed of execution, as you know, only matters in certain very small instances. Like, you are doing some tight loop calculation over and over. For example, rendering ray tracing. But even then, you could write small parts of your program in some fast language and the rest (the bulk) in a language that is 'better' in some other direction. For most apps, by the time the app is released, machines will have doubled in speed anyway, so every effort-hour you spend on making that old 500MHZ Pentium run faster is totally wasted when the 4GHZ pentiums are available!


For me, what makes a language 'better' or 'worse' are issues like:
1) What kind of app am I building? A test app? Something for customers?
2) How hard is it to learn and read; can I read someone else's code pretty easily?
3) How quickly can I build the app? I.e. assembler is great but would take a LONG time.
4) How likely is it to catch my errors for me? i.e. compiler-time warnings/errors vs runtime warnings/errors vs not catching them at all. Generally, run-time binding leads to run-time errors that compile-time binding catches at compile time. So if you are building something for customers, I generally lean towards compile-time binding. That's not always realistic, but every error of mine that the compiler catches is better than the customer seeing error dialogs about my errors!
5) What is everyone else using? For personal use, that doesn't matter (heck, I still like Snobol IV!), but if you are in Rome, do as the Romans. If your company has a lot of Java engineers, you better have a darn good reason to switch to C# or C++!

So, I appreciate the 'speed at any cost' argument, but that's what assemblers are for! Even when programming in C++, you may find that rare but occasional need to drop into assembler (I love the inline assembler!), just as when programming in Java there are somethings you call out and let some other piece of code do.

My advice: Learn C# and know it so you can make an informed decision on whether to use it for any particular application or not. Just as a carpenter knows about all kinds of tools but uses 10% of them daily, so too should you know many more languages than you use.

Then you and I can speak fondly of Snobol IV and lament its lack of general use.

Good luck! Dare to Dream!

Thank you very much for so long a reply. You have forced me into learning atleast the basics of c#. I'll be starting soon. Cheers. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.