By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,939 Members | 1,600 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,939 IT Pros & Developers. It's quick & easy.

Execution speed, Java vs. C#/J#

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
http://www.gotdotnet.com/team/compare/petshop.aspx

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
"Michael A. Covington" <lo**@www.covingtoninnovations.com.for.address> wrote
in message news:uJ**************@TK2MSFTNGP11.phx.gbl...
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

Nov 16 '05 #2

P: n/a
> > 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#?
Nov 16 '05 #3

P: n/a
Yes, take an RDBMS application and put all the data in memory; it's
astonishing how much faster it goes.

"William Ryan eMVP" <do********@comcast.nospam.net> wrote in message
news:uh**************@TK2MSFTNGP09.phx.gbl...
http://www.gotdotnet.com/team/compare/petshop.aspx

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
"Michael A. Covington" <lo**@www.covingtoninnovations.com.for.address> wrote in message news:uJ**************@TK2MSFTNGP11.phx.gbl...
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


Nov 16 '05 #4

P: n/a
William Ryan eMVP <do********@comcast.nospam.net> wrote:
http://www.gotdotnet.com/team/compare/petshop.aspx


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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5

P: n/a
> 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.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Nov 16 '05 #6

P: n/a
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in
news:MP***********************@msnews.microsoft.co m:
William Ryan eMVP <do********@comcast.nospam.net> wrote:
http://www.gotdotnet.com/team/compare/petshop.aspx
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.

--
Lasse Vågsæther Karlsen
la***@vkarlsen.no
PGP KeyID: 0x0270466B
Nov 16 '05 #7

P: n/a
Lasse Vågsæther Karlsen <la***@vkarlsen.no> wrote:
William Ryan eMVP <do********@comcast.nospam.net> wrote:
http://www.gotdotnet.com/team/compare/petshop.aspx
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".


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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #8

P: n/a
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om:
Lasse Vågsæther Karlsen <la***@vkarlsen.no> wrote:
> William Ryan eMVP <do********@comcast.nospam.net> wrote:
>> http://www.gotdotnet.com/team/compare/petshop.aspx
<snip> 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.

<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.
--
Lasse Vågsæther Karlsen
la***@vkarlsen.no
PGP KeyID: 0x0270466B
Nov 16 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.