473,883 Members | 1,725 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 13269
Jon Harrop wrote:
Mark Thornton wrote:
>Rather amusing really as unintentional use of unbuffered IO is a
frequent cause of Java benchmarks running more slowly than they should.
It seems that .NET copied that characteristic as well.

Yes. I've no idea why they do that. Isn't buffered IO a better default?!
It is easier to put a buffered wrapper around an unbuffered stream
than the the other way around.

Arne
Jun 27 '08 #271
Jon Skeet [C# MVP] wrote:
On Jun 3, 4:39 pm, Jon Harrop <j...@ffconsult ancy.comwrote:
>FWIW, F#/Mono is 3x slower than F#/.NET on the SciMark2 benchmark. I'd like
to know how performance compares between these platforms for parallel code.

If Razii is genuinely comparing Java with Mono (I haven't looked at
any of the figures) it's a silly test to start with (unless you're
specifically interested in Mono, of course). The vast majority of C#
code runs on .NET rather than Mono - and while I applaud the Mono
team's work, I seriously doubt that it has quite has much effort going
into it as Microsoft is putting into .NET. I'd expect .NET to
outperform Mono, and on microbencharks like these the difference could
be quite significant in some cases.
I have frequently seen a x2 factor between MS .NET 2.0 and Mono 1.2 !

Comparing with Mono is too easy.

Arne
Jun 27 '08 #272
Jon Skeet [C# MVP] wrote:
Now, you're using *those results* to form conclusions, right? If not,
there was little point in posting them. However, those results are of
Mono, not .NET.

This is why I've urged consistency. What's the point in debating Java
vs .NET if you keep posting links to results of Java vs Mono?
You are correct.

I would just prefer to consider .NET an overall group and call the
implementations MS .NET and Mono.

(probably MS's trademark lawyers would not like that, but ...)

Arne
Jun 27 '08 #273
Jon Skeet [C# MVP] wrote:
Even running .NET rather than Mono will only go so far - you'd need to
run it on both 64 bit and 32 bit platforms, as the runtimes do
different things. (IIRC the 64 bit CLR uses tail recursion more heavily
than the 32 bit CLR, for instance.)

If I were to find a really slow JVM, would that prove that Java is a
slower *language* than C#?
It is even more complex than that.

MS .NET 1.1, MS .NET 2.0, Mono 1.1, Mono 1.2

Win32/x86, Win64/x86, Win64/IA64, Linux/x86, MacOS X, Solaris/SPARC

that is 14 combinations.

If the benchmark involves file IO, then it would be relevant to
test different file systems on Linux as well.

For Java it is much worse.

1.4.2, 1.5.0, 1.6.0
SUN, IBM, BEA, Oracle
client VM, server VM
3-4 platforms per vendor
and a ton of VM tuning options

I would need to use BigInteger to calculate the number of combinations.

And believe me - there are huge differences in performance
characteristics between SUN, IBM and BEA !

I would say that trying to compare the speed of Java with the speed
of .NET reveals a big lack of knowledge about both Java and .NET !

Arne
Jun 27 '08 #274
Jon Harrop <jo*@ffconsulta ncy.comwrote:
My claim was clearly perfectly correct.
Rubbish. You claimed that Razii had turned the garbage collector off.

Now you have resorted to misquoting me. I think that says it all.
You've applied different options to the program to make it appear that
your claim about Razii's options were correct. I missed out the word
"effectivel y" above. Which of those is more important?

Similarly, you've later managed to quote something I wrote about *your*
set of options as if I was writing it about Razii's set of options.
He certainly hadn't, or the program would not have run to completion,
limited as it was by his options to 512MB.

For n=20?
Yes.
Just to make it absolutely clear, here is how Razii was running the
code:

java -server -verbose:gc -Xms512m -Xmx512m -XX:NewRatio=1

You have not specified "n" but it appears that your entire line of thinking
revolves around n=20.
Yes, which is what he ran.

The post where you claimed Razii had effectively claimed the garbage
collector off was message ID
<Ro************ *************** ***@posted.plus net>

If you look back up the thread directly from that to the last time
Razii had specified options (i.e. the run that was under discussion) it
was message ID <lv************ *************** *****@4ax.com>.

The exactly command line specified was:

$ time java -server -Xms512m -Xmx512m -XX:NewRatio=1 binarytrees 20
With those options, the garbage collector *does* run, and *does*
collect memory.

Here is another trivial counter example using Razii's arguments as you
quoted them:
I only quoted the memory part because that's the only part I *saw* you
change. However, if you look
$ java -server -verbose:gc -Xms512m -Xmx512m -XX:NewRatio=1 binarytrees 13
stretch tree of depth 14 check: -1
16384 trees of depth 4 check: -16384
4096 trees of depth 6 check: -4096
1024 trees of depth 8 check: -1024
256 trees of depth 10 check: -256
64 trees of depth 12 check: -64
long lived tree of depth 13 check: -1

As you can see, the GC never ran.
Your claim was absolutely incorrect, and your attempt
to confuse the matter by posting other options which *did* negate the
need for the garbage collector to run does not in any way change the
options under which Razii ran his test.

I said "the GC is effectively off". You say "Rubbish... the need for the GC
to run had been negated.". The difference is academic.
I would agree - but you're quoting me in entirely the wrong context.
Let's have a look at the statement where I talked about "the need for
the GC to had had been negated":

<quote>
Your claim was absolutely incorrect, and your attempt
to confuse the matter by posting other options which *did* negate the
need for the garbage collector to run does not in any way change the
options under which Razii ran his test.
</quote>

Oh look, it's in the context of *your* options, not Razii's.

I never claimed, nor *would* I claim, that the need for the GC to run
had been negated with Razii's options. Those are the only options which
I think should be considered in this part of the discussion, as those
are the options for which you originally claimed that the GC had been
effectively turned off.
Now rather than just repeatedly stating your claim, or arguing by using
*different* options, please address the steps above. Which of the 5
facts/deductions above do you disagree with? The conclusion directly
contradicts your claim, so you should either retract your claim or
refute the logic above.

The main problem is with your interpretation of the word "effectivel y". You
seem to think that you can add and remove this word at will without
affecting the meaning of a sentence when, in fact, you cannot.
In this case it doesn't change things. If the garbage collector had
*effectively* been turned off, it would not have been able to run to
completion.
Consequently, your conclusion (5) is wrong. It should be "Therefore the GC
had *not* been turned off". No disagreement here. But that says nothing
about my original statement.
No way. You can't realistically claim a garbage collector has been
"effectivel y" turned off when it being turned *on* is critical to the
program running to completion. What exactly do you take "effectivel y"
to mean? I take it to mean "to the same effect". Now I'm happy for
"effect" to only mean in terms of computed results rather than
performance - so a fast program can be effectively the same as a slow
program - but it can't be in terms of completing the run. Options where
the program fails to run to completion are *not* "effectivel y" the same
as options where the program runs fine.
There were two sides to my original point. Firstly, if you manually tweak
the GC parameters by hand for one specific input on one specific machine
then you are doing manual memory management.
No - you're changing the configuration options to let the automatic
memory management work more effectively. Note how I did exactly the
same to make the .NET GC use a different implementation - and again, it
sped things up.
Garbage collection means *automatic* memory management. So you can
kiss goodbye to the idea of claiming that your GC is fast (which is
exactly what Razii was trying to do). The same goes for explicitly
calling the GC from within your code (it is a form of manual memory
management).
Well, it's a hint to the garbage collector - a hint which is usually
unnecessary, but *can* occasionally be beneficial. There's a long, long
way from that to fully manual memory management though.
Secondly, Razii's technique and results for this benchmark have absolutely
no bearing on reality whatsoever. Indeed, I cannot even reproduce his
results using the same program with the same input on a slightly different
machine. So let's not pretend this is of any practical relevance.
I never have.
All you have managed to do is optimize a flawed benchmark which, as I said
from the beginning, is completely fruitless.
No argument there - but then that's not what I was responding to, was
it?
Let me make this absolutely crystal clear, so that so long as you quote
from this sentence down in your reply, everything else above is
irrelevant:

Given a run of the code with these options:

$ time java -server -Xms512m -Xmx512m -XX:NewRatio=1 binarytrees 20

You claimed that Razii effectively turned the GC off. I claim that he
certainly didn't, because with the GC having no effect the program
would not have completed.

Do you disagree with my claim that with the GC *actually* turned off
(if there were some way to do that) the program would have failed to
finish, or do you think that a (hypothetical) set of options where a
program fails to finish can be *effectively* the same as a set of
options where the program manages to run?

--
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 #275
On Jun 8, 8:39*am, Jon Skeet [C# MVP] <sk...@pobox.co mwrote:

<...>

This stuff is still appearing on clc++.

There is no C++ related content here.

regards
Andy Little

Jun 27 '08 #276
On Sun, 08 Jun 2008 12:34:34 +0100, Mark Thornton
<mt*******@optr ak.co.ukwrote:
>In real systems this is usually not true. In most applications it is
possible to get good performance from the garbage collector.
It's not only not true. It's downright false.

http://www.idiom.com/~zilla/Computer...benchmark.html

Consider what happens when you do a new/malloc: a) the allocator looks
for an empty slot of the right size, then returns you a pointer. b)
This pointer is pointing to some fairly random place.

With GC, a) the allocator doesn't need to look for memory, it knows
where it is, b) the memory it returns is adjacent to the last bit of
memory you requested. The wandering around part happens not all the
time but only at garbage collection. And then (depending on the GC
algorithm) things get moved of course as well.
The cost of missing the cache
The big benefit of GC is memory locality. Because newly allocated
memory is adjacent to the memory recently used, it is more likely to
already be in the cache.

How much of an effect is this? One rather dated (1993) example shows
that missing the cache can be a big cost: changing an array size in
small C program from 1023 to 1024 results in a slowdown of 17 times
(not 17%). This is like switching from C to VB! This particular
program stumbled across what was probably the worst possible cache
interaction for that particular processor (MIPS); the effect isn't
that bad in general...but with processor speeds increasing faster than
memory, missing the cache is probably an even bigger cost now than it
was then.

(It's easy to find other research studies demonstrating this; here's
one from Princeton: they found that (garbage-collected) ML programs
translated from the SPEC92 benchmarks have lower cache miss rates than
the equivalent C and Fortran programs.)

This is theory, what about practice? In a well known paper [2] several
widely used programs (including perl and ghostscript) were adapted to
use several different allocators including a garbage collector
masquerading as malloc (with a dummy free()). The garbage collector
was as fast as a typical malloc/free; perl was one of several programs
that ran faster when converted to use a garbage collector. Another
interesting fact is that the cost of malloc/free is significant: both
perl and ghostscript spent roughly 25-30% of their time in these
calls.

Besides the improved cache behavior, also note that automatic memory
management allows escape analysis, which identifies local allocations
that can be placed on the stack. (Stack allocations are clearly
cheaper than heap

Jun 27 '08 #277
Razii wrote:
Consider what happens when you do a new/malloc: a) the allocator looks
for an empty slot of the right size, then returns you a pointer.
Modern allocators have several arrays of slots of suitable sizes, and
can therefore easily find one in the right size. The next allocation of
that size will also be immediately adjacent. Only rather large sizes
require another approach, but I assume these are pretty rare in both
kinds of environments, and I guess that programs tend to hang on to
such large objects much longer as well. Deallocation of objects is
immediate, which often means that memory consumption is lower and not
dependent on when a GC might finally run. Also, no heaps of memory are
moved around in non-GC memory management.

IOW, there are arguments for both approaches. The GC one has the big
advantage that one big cause of errors, all errors regarding memory
use, are more or less completely eliminated. But I doubt I would call
speed one of the main factors to choose a GC.
--
Rudy Velthuis http://rvelthuis.de

"My last cow just died, so I won't need your bull anymore."
Jun 27 '08 #278
Lew
Razii wrote:
but with processor speeds increasing faster than
memory, missing the cache is probably an even bigger cost now than it
was then.
You might not have noticed, but processor speeds have been flat for the last
several years, or actually declined. Memory has gotten faster, and CPUs have
gotten more cache, so actually the trend is the opposite of what you stated.

--
Lew
Jun 27 '08 #279
Lew
Rudy Velthuis wrote:
Modern allocators have several arrays of slots of suitable sizes, and
can therefore easily find one in the right size. The next allocation of
that size will also be immediately adjacent. Only rather large sizes
require another approach, but I assume these are pretty rare in both
kinds of environments, and I guess that programs tend to hang on to
such large objects much longer as well. Deallocation of objects is
immediate, which often means that memory consumption is lower and not
dependent on when a GC might finally run. Also, no heaps of memory are
moved around in non-GC memory management.
Deallocation of young objects in Java takes no time at all. GCs of the young
generation take very little time for typical memory-usage patterns. It could
be, for a large class of programs, that memory management takes less time in a
GCed language like Java than in a language like C++ with manual memory management.
IOW, there are arguments for both approaches. The GC one has the big
advantage that one big cause of errors, all errors regarding memory
use, are more or less completely eliminated. But I doubt I would call
speed one of the main factors to choose a GC.
It can be. The problem is that assertions about speed are nearly impossible
to make /a priori/ - there are so many factors and emergent interactions
involved that one is unlikely to guess correctly without experimentation and
measurement.

--
Lew
Jun 27 '08 #280

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

Similar topics

80
3572
by: tech | last post by:
Hi, i have the following problem In file1.h namespace A { class Bar { void foo();
318
11198
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
9935
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
9791
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
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
9571
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
7122
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
5797
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...
0
5990
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3231
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.