?
Solved

Execution Speed: Java vs. C#

Posted on 2011-05-04
13
Medium Priority
?
1,256 Views
Last Modified: 2013-11-16
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.
0
Comment
Question by:StumpedAndGrateful
  • 3
  • 2
  • 2
  • +5
13 Comments
 
LVL 14

Expert Comment

by:systan
ID: 35693830
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.
0
 
LVL 6

Expert Comment

by:bartvd
ID: 35693877
Please note that in a lot of client/server applications, the speed is limited by the network speed, not by the programming language.
0
 

Author Comment

by:StumpedAndGrateful
ID: 35693901
Wow!  If Delphi is so much faster, why are Java and C# so much more popular??
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:StumpedAndGrateful
ID: 35693919
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...
0
 
LVL 23

Assisted Solution

by:wdosanjos
wdosanjos earned 80 total points
ID: 35693949
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):
http://msdn.microsoft.com/en-us/library/ff923355.aspx
0
 
LVL 11

Assisted Solution

by:brutaldev
brutaldev earned 80 total points
ID: 35693977
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.
0
 

Expert Comment

by:zhshqzyc
ID: 35694008
How about vb.net? I used to use it, now I prefer to write with c#.
0
 
LVL 11

Expert Comment

by:brutaldev
ID: 35694674
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.
0
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 1000 total points
ID: 35694963
@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.


@StumpedAndGrateful:

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.
0
 
LVL 30

Assisted Solution

by:anarki_jimbel
anarki_jimbel earned 240 total points
ID: 35694982
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? :)
0
 
LVL 30

Expert Comment

by:anarki_jimbel
ID: 35694994
OK, managed to read mrjoltcola's comment :). Totally agree.
0
 
LVL 14

Assisted Solution

by:systan
systan earned 600 total points
ID: 35695448
>>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.
eq.,
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



@mrjoltcola;
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.

Thanks
0
 

Author Closing Comment

by:StumpedAndGrateful
ID: 35724092
Very tough type of question, because there are so many other factors involved.  I appreciate all of the thoughtful answers.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question