Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: benchmarks? java vs .net (sin and cos)

Reply
Thread Tools

Re: benchmarks? java vs .net (sin and cos)

 
 
Mark Thornton
Guest
Posts: n/a
 
      06-05-2008
Razii wrote:
> On Wed, 4 Jun 2008 23:07:29 +0100, Jon Skeet [C# MVP]
> <(E-Mail Removed)> wrote:
>
>> Oh indeed. The fact that there's both Math and StrictMath is
>> particularly nice. It would be interesting to see a port of StrictMath
>> for .NET.

>
> Since 1.4 Math just calls StrictMath for sin and cos. That's how sin
> and cos got slower since 1.4. However, there is solution to it.
>
> http://pastebin.com/f126f0c27
>


That might be what appears in the library source, but it isn't what
actually happens once a call has been compiled.

Mark Thornton

 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      06-09-2008
Razii wrote:
> On Wed, 4 Jun 2008 19:49:20 +0100, Jon Skeet [C# MVP]
> <(E-Mail Removed)> wrote:
>> into the search bar, you get 0.858272132, the same as the .NET answer.
>> That can't be pure coincidence, but I've no idea where the similarity
>> is...

>
> That's pretty simple to explain. Both use hardware for angle reduction
> and get the same wrong answer. That's why it's faster but wrong. It's
> not just 1e15
>
> What about these?
>
> Console.WriteLine(Math.Sin (1e7));
>
> 0.420547793190771 (C# with .NET)
> 0.42054779319078249129850658974095 (right answer)
>
> Console.WriteLine(Math.Sin (1e10));
>
> -0.48750602507627 (C# with .NET)
> -0.48750602508751069152779429434811 (right answer)
>
> I am sure there are better examples but the point is made.


Everybody knows there is this effect. Maybe everybody except Jon H.

But does it matter ?

I don't think there will be that many usages where the differences in
accuracy between the Java way and the C# way will have much impact.

Either it will be good enough or even greater precision will be needed.

Arne
 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      06-09-2008
Patricia Shanahan wrote:
> Arguable in the case of Java. The Java Language Specification says that
> each compilation unit implicitly starts with an import of "the
> predefined package java.lang".
>
> I don't know whether C# has any libraries with such a privileged position.


There is no implicit import of namespace System.

But I am not sure that I consider that a big difference.

Both Java and C# are pretty married to their libraries anyway.

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      06-09-2008
Mark Thornton wrote:
> Jon Skeet [C# MVP] wrote:
>> The VM spec is also separate from the language spec, which is a good
>> thing. It's just a shame that the name "Java" applies to the platform,
>> the runtime, and the language.

> And at times several other things with no obvious relationship at the
> whim of Sun's marketing department.


I guess you can argue that funding Java development and giving most
of it away for free has given them the right to try and make a few
bucks selling a Java branded Linux.

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      06-09-2008
Jon Skeet [C# MVP] wrote:
> Razii <(E-Mail Removed)> wrote:
>> So we are done with this partialsums benchmark; this was the only case
>> where C# was significantly faster.

>
> And I for one have never been claiming that .NET or C# is significantly
> faster than Java overall. (If any benchmarks made custom calls to
> native code, that would be interesting. I really have no idea how JNI
> compares with P/Invoke in terms of speed. I know which is more pleasant
> to use, mind you
>
> Given how similar their overall approach is, and how both of them have
> had a lot of time and money spent optimising their VMs (with more work
> to be done, for sure) it's unsurprising that they're pretty much a tie.
>
> My conclusion: don't choose between Java and .NET on performance
> grounds. There are far better reasons to choose one or the other,
> depending on other criteria.


Jon - that is common sense - completely off topic in this thread !



Arne
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hot Requirements: 1.Sr Java Developer,2.Java Developer (Java with EJB) Isaac Java 0 01-20-2011 08:41 PM
hey i am just started java,, can anyone tell me the use ,application, why java , importance of java.. manish sahu Java 3 02-14-2008 12:00 AM
Another Question: Java and other application, Java and hardware Roberto Faenza Java 4 02-25-2007 06:18 PM
[JAVA] [EVALUATION] - The Java Failure (Sorry: The Java(tm) Failure) Ilias Lazaridis Java 0 02-01-2005 10:32 AM
Job to convert Java App 1.3.1 to Java Newest of Java Michael Kintner Java 0 11-30-2003 04:42 AM



Advertisments