[Mono-list] JVM performance: JVM as a basis for CLR
Tom
tom7ca@yahoo.com
Sun, 22 Jul 2001 12:50:37 -0700 (PDT)
Sun has two JITs, one that generates slow code and
one that generates fast code. You need to use the
"-server" flag to get the fast one.
Tom.
PS: Keep in mind that "/unsafe+" gives C# an
advantage you can probably not use in practice.
I used it merely to show that it didn't help
in my case. But you may want to try both.
--- Kunle Odutola <kunle.odutola@virgin.net> wrote:
> Interesting figures. I get very different results as
> you can see below (I'll
> post figures for the fib test too in a mo'):
>
> JAVA
> =====
>
> D:\Temp\bmark>java -showversion convj
> java version "1.3.0"
> Java(TM) 2 Runtime Environment, Standard Edition
> (build 1.3.0-C)
> Java HotSpot(TM) Client VM (build 1.3.0-C, mixed
> mode)
>
> starting
> convolve=75.88665 took 13.359
> convolve=80.14561 took 13.56
>
> .NET
> =====
>
> D:\Temp\bmark>csc /o /unsafe+ /checked- convj.cs
> Microsoft (R) Visual C# Compiler Version 7.00.9254
> [CLR version v1.0.2914]
> Copyright (C) Microsoft Corp 2000-2001. All rights
> reserved.
>
>
> D:\Temp\bmark>convj
> starting
> convolve=75.88665 took 00:00:03.1445216
> convolve=80.14561 took 00:00:03.1144784
>
>
> I was a bit puzzled by the difference to say the
> least, so I compiled it
> again with no switches.
>
> D:\Temp\bmark>csc convj.cs
> Microsoft (R) Visual C# Compiler Version 7.00.9254
> [CLR version v1.0.2914]
> Copyright (C) Microsoft Corp 2000-2001. All rights
> reserved.
>
>
> D:\Temp\bmark>convj
> starting
> convolve=75.88665 took 00:00:03.5551120
> convolve=80.14561 took 00:00:03.3347952
>
> D:\Temp\bmark>convj
> starting
> convolve=75.88665 took 00:00:03.3347952
> convolve=80.14561 took 00:00:03.3247808
>
>
> I used the .java file as supplied but did a
> conversion of the C# file
> myself. The results of running with your C# source
> file is:
> D:\Temp\bmark>csc /o /unsafe+ /checked- convj.cs
> Microsoft (R) Visual C# Compiler Version 7.00.9254
> [CLR version v1.0.2914]
> Copyright (C) Microsoft Corp 2000-2001. All rights
> reserved.
>
>
> D:\Temp\bmark>convj
> starting
> convolve=75.88665 took 00:00:04.9871712
> convolve=80.14561 took 00:00:04.9671424
>
> D:\Temp\bmark>convj
> starting
> convolve=75.88665 took 00:00:04.9771568
> convolve=80.14561 took 00:00:05.0072000
>
>
>
> This is my conversion as used in the re-test:
>
>
>
> ------------- BEGIN
> convj.cs
>
------------------------------------------------------------
> public class convj
> {
> public static double rseed =
> 0.198095803940820482309384;
>
> public static double random()
> {
> rseed = rseed * 9.2935802938408293480923 +
> 1.203985032850982902384;
> while(rseed>1.0)
> rseed -= 1.0;
> return rseed;
> }
>
> public static void fill_random(float[] outval)
> {
> for(int i=0;i<outval.Length;i++)
> outval[i] = (float)random();
> }
>
> public static void convolve(float[] outval,
> float[] inval, float[] mask)
> {
> for(int i=0,n=inval.Length;i<n;i++)
> {
> double total = 0.0;
> for(int j=0,m=mask.Length;j<m;j++)
> {
> int index = j-m/2;
> index = index<0?0:index>=m?m-1:index;
> float value = inval[index];
> total += value * mask[j];
> }
> outval[i] = (float)total;
> }
> }
>
> public static void Main(string[] args)
> {
> System.Console.WriteLine("starting");
> float[] outval = new float[65536];
> float[] inval = new float[65536];
> float[] mask = new float[256];
> for(int iter=0;iter<2;iter++)
> {
> long start = System.DateTime.Now.Ticks;
> for(int i=0;i<10;i++)
> {
> fill_random(inval);
> fill_random(mask);
> convolve(outval,inval,mask);
> }
> System.TimeSpan span = new
> System.TimeSpan(System.DateTime.Now.Ticks-start);
>
> System.Console.WriteLine("convolve="+outval[0]+"
> took "+span);
> }
> }
> }
> ------------- END
> convj.cs
>
------------------------------------------------------------
>
> Cheers,
>
> Kunle
>
>
> > -----Original Message-----
> > From: mono-list-admin@ximian.com
> [mailto:mono-list-admin@ximian.com]On
> > Behalf Of Tom
> > Sent: 22 July 2001 01:18
> > To: mono-list@ximian.com
> > Subject: [Mono-list] JVM performance: JVM as a
> basis for CLR
> >
> >
> > Given that there have been lots of arguments
> against
> > basing a Mono runtime (CLI/CLR) on a JVM based on
> > performance, I was curious to see how well
> Microsoft's
> > CRL compares to Java VMs in terms of performance.
> So,
> > without claiming that these are anywhere near
> complete
> > benchmarks, I tested two simple cases: "fib" and
> > "convolution".
> >
> > On the "fib" benchmark (mostly function calls),
> CLR
> > performs considerably worse than Sun's JVM. On
> the
> > convolution benchmark, they perform about the
> same. I
> > gave the CLR the benefit of the doubt and compiled
> > with "/unsafe+ /checked-". Based on these little
> > benchmarks, I see no performance advantage to CLR.
> > This seems in agreement with other recent
> comparisons
> > of CLR and JVM. I have yet to see any
> reproducible
> > evidence that the CLR actually performs
> significantly
> > better on any task; if you know of any (including
> > source code), I'd like to know about it.
> >
> > What does this mean? I don't want to bring up the
> > issue of creating a Java foundation for Gnome,
> since
> > that's not where the project is going. But I
> think it
> > suggests again that starting with a JVM
> implementation
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/