[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    [Mono-dev] how to improve mono performance
From:       zhu shi song <zhushisongzhu () yahoo ! com>
Date:       2005-11-17 4:30:23
Message-ID: 20051117043023.95381.qmail () web36908 ! mail ! mud ! yahoo ! com
[Download RAW message or body]

Dear lists,
  I've got one test example and tested it using linux
mono and windows .NET on the same machine.  The
results showed that the performance of linux mono is
much bad than windows .NET. 
Linux Mono:
 ArrayList strings test.............3311 ms
 StringBuilder test.................4008 ms
 Integer & Floating ADD.............15145 ms
 Exception test.....................621 ms
 Reflection and recursion...........9421 ms
Windows .Net:
 ArrayList strings test.............1109 ms
 StringBuilder test.................1437 ms
 Integer & Floating ADD.............2734 ms
 Exception test.....................4046 ms
 Reflection and recursion...........5843 ms
Machine configuration:
 RAM: 512M DDR
 CPU: Intel C4 2.0G
OS:
 Windows 2003 Server .NET 1.1 Framework
 Fedora Core 4 with mono compiled from svn

Now I try to port my aspx web application to linux
mono from windows 2003 .net framework.  But regarding
of performance, I wonder whether it is deserved.
  Maybe I lack some tips to improve linux mono
performance.  If someone knows pls help me.
  tks
  zhu




	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com
["compare.cs" (text/x-csharp)]

using System;
using System.Collections;
namespace TestNamespace
{
      public class TestClass
      {
            static long ticks = 0;
            public static void InitTicks()

            {
                  TestClass.ticks = DateTime.Now.Ticks;
            }
            public static void ShowTime(string str)
            {
                  long newTicks = DateTime.Now.Ticks;
                  //milliseconds, not Microsoft :)
                  double ms = (newTicks - TestClass.ticks) / TimeSpan.TicksPerMillisecond;
                  Console.WriteLine("{0}{1} ms", str.PadRight(35, '.'), ms);
                  TestClass.ticks = DateTime.Now.Ticks;
            }
            public static void Test1()
            {
                  ArrayList a = new ArrayList();
                  for(int i=0;i<1000000;i++)
                  {
                        string str = i.ToString();
                        a.Add(str);
                  }
                  ShowTime("ArrayList strings test");
                  System.Text.StringBuilder strBuilder = new System.Text.StringBuilder();
                  Random rnd = new Random();
                  foreach(object strObj in a)
                  {
                        strBuilder.Append(strObj as string);
                        strBuilder.Append(rnd.Next().ToString());
                  }
                  string s = strBuilder.ToString();
                  if(s == "Dsadasdasdsa")
                  {
                        throw(new Exception("no way..."));
                  }
                  ShowTime("StringBuilder test");
            }
            public static void Test2()
            {
                  int i = 0;
                  double d = 0.0;
                  for(i=0; i<1000000000; i++)
                  {
                        d += i;
                  }
                  double d2 = d/2;
                  ShowTime("Integer & Floating ADD");
            }
            public static void Test3()
            {
                  int i = 0;
                  int sum = 0;
                  for(i=0;i<100000;i++)
                  {
                        try
                        {
                              if(i is int)
                              {
                                    throw(new Exception("the i integer is an integer.. oh no..."));
                              }
                        }
                        catch(Exception ex)
                        {
                              if(ex is NotImplementedException)
                              {
                                    Console.Write("who's responsable for this ?");
                              }
                        }
                  }
                  int res = sum/2;
                  if(res == -321)
                        throw(new Exception("this is odd"));
                  ShowTime("Exception test");
            }
            public static void Recursive(string str)
            {
                  string name = System.Reflection.MethodBase.GetCurrentMethod().Name;
                  if(str.Substring(0, name.Length) == name)
                  {
                        int i = Convert.ToInt32(str.Substring(name.Length));
                        if(i < 1000)
                        {
                  //          Console.Write(i.ToString()+"\n");
                              Recursive(name + (i+1).ToString());
                        }
                  }
            }
            public static void Test4()
            {
                  for(int i=0;i<1000;i++)
                  {
                        Recursive("Recursive0");
                  }
                  ShowTime("Reflection and recursion");
            }
            public static void Main()
            {
                  InitTicks();
                  Test1();
                  Test2();
                  Test3();
                  Test4();
            }
      }
}


_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic