• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1303
  • Last Modified:

Execution Speed: Java vs. C#

I'm planning on creating a large client server desktop application.  I have MySQL as the database.  I want to choose a programming language solely based on execution speed.  Which one should I choose?  Please make answers as simple as possible.
  • 3
  • 2
  • 2
  • +5
5 Solutions
Execution Speed: Java vs. C#?
Java is the slowest, even compared to the other languages.

If you based on speed, Delphi or C Language are the best and native.
.NET? slow also,  but not compared to Java.
Please note that in a lot of client/server applications, the speed is limited by the network speed, not by the programming language.
StumpedAndGratefulAuthor Commented:
Wow!  If Delphi is so much faster, why are Java and C# so much more popular??
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

StumpedAndGratefulAuthor Commented:
How do I delete a zone this is mapped to?  I accidentally ended up with this mapped to Oracle ERP, which it does not relate to...
That's a tricky (and holy war type of) question given that "execution speed" is more tied to a good design/architecture than to a choice of programming language.

With that said, from a pure programming language / framework point of view I think C# has the edge. You also mentioned "desktop application", where C# with WPF has a clear advantage on a Windows desktop environment.

You may want to review the following benchmark between .NET (C#) and IBM Websphere (Java):
C# is only getting significantly faster as the CLR keeps improving. MS also have plans of creating a kernel level runtime (Redhawk if I'm not mistaken) so that managed code runs even faster because the it's built into the OS. This will boost managed code ever so close to running as fast as native counterparts such as C++. So in my opinion C# is a better investment and has overtaken Java (and will continue to) by a long shot.
How about vb.net? I used to use it, now I prefer to write with c#.
VB.NET and C# have recently become closely aligned in terms of features and gone are the days where they would end up with significantly different IL. VB.NET vs C# is really a language preference but have the same capabilities and use the .NET framework and the same CLR to run. Performance wise there will be no different between VB.NET and C#. C# does seem to have a much bigger following so you see major project are usually written in C# which would give you a further edge if investing in C#.

Because .NET is language agnostic you can't really compare performance because the are build on the same technology.
@systan: You should provide proof to support your statements, otherwise they provide no value. Besides that, they are plain wrong. There are plenty of languages which are orders of magnitude slower than Java. That doesn't mean Java is better or worse.


Your question is, to me, misguided, but at least clear. The two languages mentioned are approximately similar in raw execution speed, with the edge going to C# on Windows. But choosing a desktop language solely based on execution speed is a really bad approach for all sorts of reasons. The languages may be with 10% of each other in raw CPU, but they are drastically different in terms of development environments, productivity tools, available commercial third-party libraries, integration with windows end user experience.

Both CLR and JVM have advanced JIT compiler cores in their execution engines, so they both approach C/C++ in actual execution speed. I don't make this up, I've actually been involved in real world research around languages and VMs. I assisted a friend of mine (John Hart, author of Win32 System Programming) in research for an article that compared C# to C and C++ with various algorithms including basic disk techniques with single and multi-threaded implementations. We actually found that the CLR (C#) was outperforming C++ in some programs, apparently due to the JIT's ability to both due better code parallelism and tighter compiles on the fly. All that said, it is sort of moot when it comes to desktop development. The bulk of time spent using a desktop app involves clicking, scrolling, dragging, etc. with very little time spent crunching the CPU. Only in specific applications do we really use a lot of CPU, such as CAD, 3D processing (much offloaded to GPU), parsing XML, processing images, etc. None of this matters if you are writing a "client/server" app, because then most of the time the user is waiting on the server responses and mostly feels the network latency, not the raw CPU. For client/server apps Java and C# are virtually identical in speed.

So...., you need to choose based on other things. Superior development IDE, powerful component kits & APIS, close integration with the desktop (we assume you mean Windows), total cost of ownership, time to market, etc.

In those categories, Java (Eclipse, IntelliJ, Netbeans) loses to Visual Studio, Delphi and C++Builder. Swing and JSF have not lived up to their hype, while WinForms and WPF keeps getting better. Our shop does Java and .NET side by side, and for the Windows desktop, we've had customers actually contract us to write Java GUI apps, only to have us rewrite them in .NET months later just because Java "looks and feels" like Java, whereas C# looks and feels like Windows. Java's GUI builders are stone-age compared to the other alternatives.

For client-server, web services are also important. .NET wins there too, web services are mostly point and click.

In short, in my book, C# and Java are both cars that will go 160mph. So pick the one with the better warranty, price and gas mileage as well as drive-side air bags.
Honestly, if you are going to use MySQL as a database my conclusion is that the application is not so big, complex and not expecting too much traffic/connections/users/data requirements etc.

In this case I believe performance differences between Java and C# will not be noticeable. All I wanna say you may need to consider other criteria to choose a language: cost/ team qualification etc.
personally, I am happy with .Net and work with C# and VB. But I love Java :)

To those who claims Java is too slow etc. Why some HUGE companies choose Java for their HUGE client-server applications? Like mobile phone systems? Do you they they are less clever than you? :)
OK, managed to read mrjoltcola's comment :). Totally agree.
>>Wow!  If Delphi is so much faster, why are Java and C# so much more popular??
>>To those who claims Java is too slow etc. Why some HUGE companies choose Java for their HUGE client-server applications? Like mobile phone systems? Do you they they are less clever than you? :)

LoL, because people/developers follow others without understanding the whole language system.
Just like john told peter that java is nice easy to program that is a multi-platform...bla, bla bla
then peter told his colleague without proper consultation to the veteran experts,  then the rest of the company follows.
Just like anyone following google search that don't analyze the real solution.
Think what viruses do.

It would be exciting if you add post in Delphi/c zone, but you can't now.

>>Please note that in a lot of client/server applications, the speed is limited by the network speed.
All is limited, but speed can be change defending on the language your using.

So,  Java?
Even in Java using Hibernate framework for mapping an object is slow until now, no matter how they tame to be more fast, they can't because it is written already in Java internal system.

The Only area that Java will be fast?, remove/devide the multi-platform.
Just like
Lazarus > multi-platform, write once compile anywhere. <this will kill java someday>
Java > multi-platform, write once run anywhere

.NET? are just good and easy when you used it because functions are based on framework thats easy to follow, and frameworks did the slowness.

it is written that pascal and c language as the native languages are the most speedy in all area of software application execution.    Tested and proven.

But don't bother using pascal<delphi[windows]/lazarus[multi-platform]> or c, because you'll never notice it if you have the max/fastest cpu, memory and hd.

for my final answer; since you don't want pascal<delphi[windows]/lazarus[multi-platform]> or c
Select .NET c#, not Java.

Good Luck

I've test a lot of languages, that's what it is, tested and proven<me and my colleague only>
You got good comment last.

StumpedAndGratefulAuthor Commented:
Very tough type of question, because there are so many other factors involved.  I appreciate all of the thoughtful answers.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now