473,651 Members | 2,750 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
318 10948
On Tue, 03 Jun 2008 20:07:00 +0100, Jon Harrop <jo*@ffconsulta ncy.com>
wrote:
>So having to write your own basic trig functions in Java so that you can be
only 2x slower than other languages doesn't bother you?
It's not 2x slower with my trig function on my computer.

On the other hand, C# results are not accurate for trig functions.

using System;
using System.IO;

class Test
{
static void Main(){
Console.WriteLi ne(Math.Sin (1e15));
}
}
The answer I get from C# is: 0.8582721324763 73

with Java I get 0.8582727931702 359

Checking the answer with maple, I get
0.8582727931702 358355238863908 484066466002034

How are you going to fix C# in this case?

Does it bother you that C# gave wrong answer?

Jun 27 '08 #61
On Tue, 3 Jun 2008 20:11:45 +0100, Jon Skeet [C# MVP]
<sk***@pobox.co mwrote:
>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.
Is this guy Jon Skeet really this stupid?

Let me know so I can add him to ignore list.


Jun 27 '08 #62
Jon Skeet [C# MVP] wrote:
Mark Thornton <mt*******@optr ak.co.ukwrote:

<snip>
>There are some FJ examples here:
http://artisans-serverintellect-com....efault.asp?W32

The recursive matrix multiplication is my contribution.

Right. It still looks a bit involved - which is only to be expected,
really. I haven't taken it in fully yet though - will aim to do so at a
later date. Might try porting to Parallel Extensions...
Frameworks like Fork/Join can only go so far in easing tasks like matrix
multiplication. Given that my Java code won't be making best use of
SSE, I was quite pleased with the performance of the result.

Mark Thornton
Jun 27 '08 #63
Razii wrote:
Is this guy Jon Skeet really this stupid?

Let me know so I can add him to ignore list.
Razii, if you hope to ever have any positive effect in your
communication - e.g. convince anyone that you have a clue - you'll have
to work much harder not to look like a naive 13 year old with
undeveloped social skills.

Plonk etc.

-- Barry

--
http://barrkel.blogspot.com/
Jun 27 '08 #64
Jon Skeet wrote:
Now using Parallel Extensions, and the lamdba expressions of C# 3:

public override void Generate()
{
Parallel.For(0, Height, row =>
{
int index = row * Width;
for (int col = 0; col < Width; col++)
{
Data[index++] = ComputeMandelbr otIndex(row, col);
}
});
}

I can't imagine many transformations being simpler than that - and the
results are great.
How have you found Parallel.For to perform?

I've found that my own naive (i.e. quick hack with little thought)
implementations of Parallel.For that dispatch over a fixed number of
threads (one thread per core) outperform the ones in the TPL by quite a
bit - TPL seemed to have had around ~20% overhead in the particular
microbenchmark I was trying to scale over my quad core.

I must dig it out and analyse the discrepancy, and blog about it, when I
find time.

-- Barry

--
http://barrkel.blogspot.com/
Jun 27 '08 #65
On Tue, 03 Jun 2008 22:27:12 +0100, Barry Kelly
<ba***********@ gmail.comwrote:
>Plonk etc.
You must be a newbie, moron. No one ever plonks me. You can try
though, as you did.

As for Jon Skeet, what kind of reply do you expect? I explained to him
that I don't have Mono, and the benchmarks I am using are at shootout
site (not that I myself am using Mono). The link to the blog I posted
also makes that clear, but yet the guy continued with the same line
that I am comparing Mono. Is he stupid or just doesn't take the time
to read carefully? Take your pick.
Jun 27 '08 #66
Barry Kelly <ba***********@ gmail.comwrote:
I can't imagine many transformations being simpler than that - and the
results are great.

How have you found Parallel.For to perform?
Very well - see my last few blog posts.
I've found that my own naive (i.e. quick hack with little thought)
implementations of Parallel.For that dispatch over a fixed number of
threads (one thread per core) outperform the ones in the TPL by quite a
bit - TPL seemed to have had around ~20% overhead in the particular
microbenchmark I was trying to scale over my quad core.

I must dig it out and analyse the discrepancy, and blog about it, when I
find time.
I wouldn't be surprised if some individual test cases did badly in
microbenchmarks . Without even looking at your code, my guess is that
you may find your code doesn't work as well when there's other load on
the processor (e.g. effectively taking up one core with a different
process) whereas work stealing should (I believe) cope with that
reasonably well.

But as I point out on the most recent blog entry, accurately
benchmarking this kind of thing and being able to interpret the results
sensibly is basically beyond my current understanding (and time to
spend on it).

--
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 #67
On Tue, 3 Jun 2008 21:04:47 +0100, Jon Skeet [C# MVP]
<sk***@pobox.co mwrote:
>Has it occurred to you that that may have an effect on the results?
No, it won't have a major effect.

Jun 27 '08 #68
On Tue, 03 Jun 2008 15:14:52 -0500, Razii <kl*****@mail.c omwrote:
>The answer I get from C# is: 0.8582721324763 73

with Java I get 0.8582727931702 359

Checking the answer with maple, I get
0.858272793170 235835523886390 848406646600203 4

How are you going to fix C# in this case?

Does it bother you that C# gave wrong answer?
Console.WriteLi ne(Math.Sin (1e7));

0.4205477931907 71 (C# with .NET)
0.4205477931907 824912985065897 4095 (right answer)

Console.WriteLi ne(Math.Sin (1e10));

-0.4875060250762 7 (C# with .NET)
-0.4875060250875 106915277942943 4811 (right answer)

Console.WriteLi ne(Math.Sin (1e15));

0.8582721324763 73 (C# with .NET)
0.8582727931702 358355238863908 484 (right answer)

So C# doesn't get 15-17 digit accuracy of double for sin and cos.
That's the only reason it's faster in partialsums benchmark. By using
FastMath class, the times for both is about same on my computer.

On the other hand, you still need to 'optimize' 4 benchmarks where
..NET is much slower: binarytrees, sum-col, recursive, revcomp.
Jun 27 '08 #69
Lew
Mark Thornton wrote:
Given that my Java code won't be making best use of SSE
Are you sure of that?

If true, it's one more area for Hotspot authors to approach.

--
Lew
Jun 27 '08 #70

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

Similar topics

80
3500
by: tech | last post by:
Hi, i have the following problem In file1.h namespace A { class Bar { void foo();
358
13052
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
8275
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
8802
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
8697
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
7297
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...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4144
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
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2699
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
2
1587
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.