Just pasting your examples into a new NetBeans project and a new
MonoDevelop project, I can't reproduce your results. I ran this on
Windows, and I think MonoDevelop might be using .NET runtime rather
than the Mono runtime (I don't know - I also had to convert StopWatch
to DateTime to get it to compile):

JDK 7/Windows
664579 primes were found in 10628 ms

C#/Windows
664579 primes were found in 12505 ms

C#/Windows (find/replace all long to ulong)
664579 primes were found in 10642 ms

This concept of the embedded micro VMs is really something that I
think it is important for the Java community to understand and
discuss. That's my main reason for posting and discussing.

I'm less interested in debating with C# fanatics. Two others in this
thread are insisting that Java runtime performance is a big
showstopper. After looking at benchmarks, Java is actually running
faster than C#, but I don't really want to debate that, I'm more
interested in promoting a major improvement to client Java.

On Jan 24, 9:26 am, Casper Bang <[email protected]> wrote:
> I spent 10 minutes cooking up 2 naive implementations of finding primes
> between 1 and 10^7 in both C# [http://pastebin.com/RDGQZPAr] and Java 
> [http://pastebin.com/JpY8FsA1], and the result is that C# is faster:
>
> Java: 664579 primes were found in 8262 ms
> C#: 664579 primes were found in 7698.878 ms
>
> ...using default configurations for JDK7 (Server HotSpot) and Mono 2.10.5
> JIT on my 64bit Ubuntu workstation. It's pretty simple CPU work with method
> invocation within iteration, some increments/adds, a bitwise-operation, a
> library call, modulus and of course branching/comparisons.
>
> Now notice what happens when I change the type from long to ulong (unsigned
> long) in C#:
>
> C#: 664579 primes were found in 5651.8524 ms
>
> It's my experience that C#'s extra features (in this case, unsigned types)
> just caters better to programming into the language, not in it* and more
> predictable performance. In other words, the JVM JIT might be superior to
> Mono's, but that's hardly the whole story!
>
> * Steve McConnell, Code Complete.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to