Execution speed, Java vs. C#/J#

  • Thread starter Michael A. Covington
  • Start date
M

Michael A. Covington

Has anyone made any tests they'd like to tell me about?

--

Michael A. Covington - Artificial Intelligence Ctr - University of Georgia

"In the core C# language it is simply not possible to have an uninitialized
variable, a 'dangling' pointer, or an expression that indexes an array
beyond its bounds. Whole categories of bugs that routinely plague C and C++
programs are thus eliminated." - A. Hejlsberg, The C# Programming Language
 
M

Michael A. Covington

Has anyone made any tests they'd like to tell me about?

What about essentially the same program running in Java and compiled in J#?
Or the same algorithm in Java and C#?
 
M

Mike Schilling

Yes, take an RDBMS application and put all the data in memory; it's
astonishing how much faster it goes.
 
C

cody

Michael A. Covington - Artificial Intelligence Ctr - University of Georgia
"In the core C# language it is simply not possible to have an uninitialized
variable, a 'dangling' pointer, or an expression that indexes an array
beyond its bounds. Whole categories of bugs that routinely plague C and C++
programs are thus eliminated." - A. Hejlsberg, The C# Programming
Language

Between C# and J# should be no difference, since both run in the CLR and
producing IL-code and calling .NET framework methods.
Maybe C# could be a bit fast because J# has lots of classes emulating a JVM
which internally just calls the .NET framework.

For C# vs. Java, there should be no significant difference. The only
difference is a GUI application where C# is significantly faster since it
uses native windows controls.
 
J

Jon Skeet [C# MVP]

William Ryan eMVP said:

That has been a highly controversial benchmark though, with many people
finding easily fixable performance problems in the Java implementation
and serious design flaws in the .NET implementation.

The real bottom line (IMO) is that there are some situations where Java
will perform faster than .NET, and some situations where .NET will
perform faster than Java, running like-for-like code. You're much more
likely to see performance differences due to architectural differences
(as with the Petshop example) which will require balancing
elegance/maintainability and performance, than you will see differences
due to the CLR vs the JVM.
 
L

Lasse Vågsæther Karlsen

That has been a highly controversial benchmark though, with many people
finding easily fixable performance problems in the Java implementation
and serious design flaws in the .NET implementation.

To quote the web page for the Sun Java Pet Store application:
JavaTM Pet Store Demo 1.3.2
The Java Pet Store Demo is a sample application from the Java 2
Platform, Enterprise Edition ("J2EE") BluePrints Program at Java
Software, Sun Microsystems. It demonstrates how to use the capabilities
of the J2EE 1.3 platform to develop flexible, scalable, cross-platform
enterprise applications.
The Java Pet Store Demo comes with full source code and documentation,
which illustrate the typical design decisions and tradeoffs a developer
makes when building an enterprise application. The demo shows how to
use JavaServer Pages ("JSP"), JavaTM Servlet, Enterprise JavaBeans
("EJBTM"), and Java Message Service ("JMS") technologies. It also uses
new technologies in the J2EE 1.3 platform, which you can experiment
with and learn how to use in your own enterprise solutions.
With real, working code illustrating the BluePrints guidelines, the
Java Pet Store Demo reduces the learning curve of the J2EE 1.3
platform, enabling you to deliver complete end-to-end solutions with
faster time-to-market.

According to this, I would understand the Pet Store to be the way Sun
wants people to write proper Java applications which are "flexible,
scalable, cross-platform".

The sad truth however is that once Microsoft went through the hoops of
rewriting it so that it outruns the java version by several factors,
people have gone to a great length picking apart the Java version and
found a lot of problems with it, like under-use of stored procedures.

This means that the benchmarks simply benchmark a java implementation of
the Pet Store and a .NET implementation of the same, with somewhat the
same functionality. It does not benchmark the platforms they run on.

I would consider this the same as implementing a bubble-sort in Java and
a quicksort in .NET and then claim .NET is superior to Java, or vice
versa.

It is a big strange though that Sun hasn't either changed the wording on
their web page, gone out and clarified their stand on this, or fixed the
application.
 
J

Jon Skeet [C# MVP]

Lasse Vågsæther Karlsen said:
To quote the web page for the Sun Java Pet Store application:




According to this, I would understand the Pet Store to be the way Sun
wants people to write proper Java applications which are "flexible,
scalable, cross-platform".

Right - although I don't believe they're claiming it's as optimised as
it might be.
The sad truth however is that once Microsoft went through the hoops of
rewriting it so that it outruns the java version by several factors,
people have gone to a great length picking apart the Java version and
found a lot of problems with it, like under-use of stored procedures.

Sure. A lot of these problems can be fixed *without* changing the
overall architecture, however - whereas the latter is what MS did.
This means that the benchmarks simply benchmark a java implementation of
the Pet Store and a .NET implementation of the same, with somewhat the
same functionality. It does not benchmark the platforms they run on.

But the point is it's *not* a .NET implementation of the same - they've
thrown away the MVC nature of it, to start with.
I would consider this the same as implementing a bubble-sort in Java and
a quicksort in .NET and then claim .NET is superior to Java, or vice
versa.

Exactly. It's basically completely useless as a benchmark, as far as I
can see.
It is a big strange though that Sun hasn't either changed the wording on
their web page, gone out and clarified their stand on this, or fixed the
application.

Indeed. I think enough people have realised that it's a bogus benchmark
that they've decided not to pursue it, but I agree it's somewhat odd.
 
L

Lasse Vågsæther Karlsen

But the point is it's *not* a .NET implementation of the same -
they've thrown away the MVC nature of it, to start with.
<snip>

Right, that's what I meant, should've been a bit clearer :)

What I meant to say is that Microsoft has focused on the functionality as
seen by the end-user, and used whatever means they can to make the back-end
provide that functionality in a fast manner, even if that meant doing
things in a very different way from what the Java version does.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top