473,836 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

benchmarks? java vs .net

The shootout site has benchmarks comparing different languages. It
includes C# Mono vs Java but not C# .NET vs Java. So I went through
all the benchmark on the site ...

http://kingrazi.blogspot.com/2008/05...enchmarks.html

Just to keep the post on topic for my friends at comp.lang.c++, how do
I play default windows sounds with C++?

Jun 27 '08
358 13248
Razii <py******@gmail .comwrote:
On Mon, 9 Jun 2008 09:09:12 -0700 (PDT), "Jon Skeet [C# MVP]"
<sk***@pobox.co mwrote:
Now, on how *applicable* these benchmarks are to real world
performance

The benchmark shows that Java's GC is easier to tune for given
situation. Many options are available to tune GC

http://java.sun.com/javase/technolog.../vmoptions.jsp
.... and it's rarely the case that it's worth tuning them, in my
experience. There are exceptions, of course, but my initial instinctive
reaction is to leave the defaults as they are.

--
Jon Skeet - <sk***@pobox.co m>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jun 27 '08 #311
Razii <py******@gmail .comwrote:
I haven't looked at regexdna or recursive yet, but for binarytrees I
didn't see .NET being twice as slow. With both sets of tweaks, .NET
was about 50% slower than Java on my box, and by your own stats (15s
vs 25s) it's only ~66% slower. Exaggerating the figures undermines
your point rather than improving it. (The 15s vs 25s was in message
<gd************ *************** *****@4ax.com>. )

In your message, you said with -server it was ~15s vs ~28s. That's 2
second short of twice slower.
Yes, which still doesn't mean "twice as slow" - and notice your choice
to take the worst possible set of figures (mine) instead of yours.
(Despite using your own in every other case.)

However, you snipped the most important bit of my previous post:

<quote>
Now, on how *applicable* these benchmarks are to real world
performance, I'm entirely with Jon Harrop: they may be somewhat
interesting in and of themselves, but they're not good predictors of
what real applications will do. For real world applications, you can
rarely get a massive improvement by tweaking the garbage collector,
for instance - partly because real world applications tend to execute
a far wider range of code. Benchmarks are naturally myopic.

As I've said before in this thread (I think) performance isn't
generally a good reason to choose between Java and .NET. There are far
more important criteria.
</quote>

The benchmarks test small, very precise pieces of a program. Optimising
for those pieces will often perturb the performance of the rest of the
program.

As an interesting exercise, could you find the "best" *consistent* set
of JVM options to run *all* your tests under? It still won't be
representative of a real program (which doesn't tend to have
bottlenecks of this sort) but it will be more reasonable. In real life
you don't get to change the garbage collection options just for a
single piece of code - you get one set for the whole program.

I will agree that it *is* a bit of a pity that the .NET GC isn't more
tweakable, as there are certainly occasions where it could help. I
suspect it would be used in plenty of *other* situations, mind you...

--
Jon Skeet - <sk***@pobox.co m>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jun 27 '08 #312
Jon Skeet [C# MVP] wrote:
Razii <py******@gmail .comwrote:
>On Mon, 9 Jun 2008 09:09:12 -0700 (PDT), "Jon Skeet [C# MVP]"
<sk***@pobox.c omwrote:
>>Now, on how *applicable* these benchmarks are to real world
performance
The benchmark shows that Java's GC is easier to tune for given
situation. Many options are available to tune GC

http://java.sun.com/javase/technolog.../vmoptions.jsp

... and it's rarely the case that it's worth tuning them, in my
experience. There are exceptions, of course, but my initial instinctive
reaction is to leave the defaults as they are.
It is worthwhile selecting one of the low pause collectors if that is
what you need. If you know you will need a 500MB heap then you can save
a bit of time by setting the minimum size to 500MB (this doesn't save as
much time as it used to).

Mark Thornton
Jun 27 '08 #313
Lew
Razii <py******@gmail .comwrote:
>>situation. Many options are available to tune GC

http://java.sun.com/javase/technolog.../vmoptions.jsp
Jon Skeet [C# MVP] wrote:
>... and it's rarely the case that it's worth tuning them, in my
experience. There are exceptions, of course, but my initial
instinctive reaction is to leave the defaults as they are.
Mark Thornton wrote:
It is worthwhile selecting one of the low pause collectors if that is
what you need. If you know you will need a 500MB heap then you can save
a bit of time by setting the minimum size to 500MB (this doesn't save as
much time as it used to).
Likewise it is worthwhile switching to a parallel collector in a
multiprocessor environment.

Jon's experience must be limited. Where I work they tune the GC quite
carefully for their various application suites. They definitely find it
worthwhile, given the high volumes they process.

--
Lew
Jun 27 '08 #314
Razii wrote:
On Mon, 09 Jun 2008 14:17:13 +0100, Jon Harrop <jo*@ffconsulta ncy.com>
wrote:
>>Firstly, your tweak did not break the program for other (previously valid)
inputs as Razii's does.

Have some decency and don't lie. My tweak doesn't break the program
for any previously valid input.
The program used to work for n=22 on my machine. With your tweak it no
longer works for n=22 because it runs out of heap space.

So you broke the program for previously valid input.

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
Jun 27 '08 #315
On Mon, 09 Jun 2008 16:56:48 +0100, Jon Harrop <jo*@ffconsulta ncy.com>
wrote:
>I cranked up the heap until the GC never ran. Surely we can agree that the
GC was effectively off when it never even ran?!
GC never runs if you enter n=7, even without any command-line
arguments. You are a fool. Just because GC doesn't need to run
doesn't mean it's off. When the memory is full, GC will run...
Jun 27 '08 #316
On Mon, 09 Jun 2008 16:56:48 +0100, Jon Harrop <jo*@ffconsulta ncy.com>
wrote:
On a different machine with a different VM the exact same
test might very well fail.
It won't fail. You have posted ZERO evidence that the test fails ony
any machine.

Jun 27 '08 #317
Razii wrote:
On Mon, 9 Jun 2008 09:09:12 -0700 (PDT), "Jon Skeet [C# MVP]"
<sk***@pobox.co mwrote:
>>I haven't looked at regexdna or recursive yet, but for binarytrees I
didn't see .NET being twice as slow. With both sets of tweaks, .NET
was about 50% slower than Java on my box, and by your own stats (15s
vs 25s) it's only ~66% slower. Exaggerating the figures undermines
your point rather than improving it. (The 15s vs 25s was in message
<gd********** *************** *******@4ax.com >.)

In your message, you said with -server it was ~15s vs ~28s. That's 2
second short of twice slower.
I get:

n=16
Java: 2.17s
F#: 2.21s

n=20
Java: 41s
F#: 45s

n=22
Java: 737s
F#: 311s

The only significant difference is the last result where .NET is >2x faster
than Java and I had to use the original Java because your tweaked version
is broken and cannot even handle that computation.
As for recursive, .NET is 1.5 times slower:
...
I get:
F#: 3.0s
Java: 3.6s

So F#/.NET is 20% faster than Java on recursive here.
Regexdna. .NET is about 25% slower:
...
I get:

Java: 5.17s
F#: 4.08s

So .NET is 25% faster than Java here as well.

Java is still slower on revcomp and is also slower on four SciMark2
benchmarks:

F#:
FFT 337 MFLOPS .NET is 4% faster than Java
SOR 612 MFLOPS .NET is 19% faster than Java
Monte Carlo 102 MFLOPS .NET is 38% faster than Java
Sparse 451 MFLOPS
LU 757 MFLOPS .NET is 11% faster than Java
Average 452

Java:
FFT 324 MFLOPS
SOR 514 MFLOPS
Monte Carlo 74 MFLOPS
Sparse 461 MFLOPS
LU 683 MFLOPS
Average 411

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
Jun 27 '08 #318
On Tue, 10 Jun 2008 02:51:01 +0100, Jon Harrop <jo*@ffconsulta ncy.com>
wrote:
>Your program is broken:
It isn't "broken" on mine as I showed. If on your computer it doesn't
run, increase the heap-size. Nothing is "broken." C# has access to the
entire ram (and it uses over 700 MB with n=22).

Jun 27 '08 #319
On Tue, 10 Jun 2008 02:53:16 +0100, Jon Harrop <jo*@ffconsulta ncy.com>
wrote:
>Here is your program failing on my machine (again) where others succeeded:
Since you have posted other claims that were not reproducible, I will
take this claim with a grain of slat unless someone else verifies it.
The program works fine on my computer.

Second, C# has access to entire RAM. Increase Xmx and Xms to 1600m
and java version again is faster

$ time binarytrees 22 (C#)
stretch tree of depth 23 check: -1
8388608 trees of depth 4 check: -8388608
2097152 trees of depth 6 check: -2097152
524288 trees of depth 8 check: -524288
131072 trees of depth 10 check: -131072
32768 trees of depth 12 check: -32768
8192 trees of depth 14 check: -8192
2048 trees of depth 16 check: -2048
512 trees of depth 18 check: -512
128 trees of depth 20 check: -128
32 trees of depth 22 check: -32
long lived tree of depth 22 check: -1

real 2m6.072s
$ time java -server -Xms1600m -Xmx1600m -XX:NewRatio=1 binarytrees 22
stretch tree of depth 23 check: -1
8388608 trees of depth 4 check: -8388608
2097152 trees of depth 6 check: -2097152
524288 trees of depth 8 check: -524288
131072 trees of depth 10 check: -131072
32768 trees of depth 12 check: -32768
8192 trees of depth 14 check: -8192
2048 trees of depth 16 check: -2048
512 trees of depth 18 check: -512
128 trees of depth 20 check: -128
32 trees of depth 22 check: -32
long lived tree of depth 22 check: -1

real 1m22.414s
Jun 27 '08 #320

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

80
3557
by: tech | last post by:
Hi, i have the following problem In file1.h namespace A { class Bar { void foo();
318
11171
by: King Raz | last post by:
The shootout site has benchmarks comparing different languages. It includes C# Mono vs Java but not C# .NET vs Java. So I went through all the benchmark on the site ... http://kingrazi.blogspot.com/2008/05/shootout-c-net-vs-java-benchmarks.html Just to keep the post on topic for my friends at comp.lang.c++, how do I play default windows sounds with C++?
0
9813
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10831
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10536
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6976
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5645
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3108
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.