[Mono-devel-list] GC/Memory allocation performance

Jörg Rosenkranz joergr at voelcker.com
Fri May 30 08:55:25 EDT 2003


Hi all!

I've tested memory allocation of Mono compared to MS Runtime when 
allocating many small objects.

It appears that there is a huge performance difference between 
the two implementations. Is there any work in progress in this area 
to improve Mono's performance?

======================== Begin of sample code ========================
using System;

namespace Test
{
	public class Dummy
	{
		private string s;
		
		public Dummy()
		{
			s = "dummy";
		}
	}
	
	public sealed class TestClass
	{
		public static void Main()
		{
			int 		i	= 0;
			int			j	= 0;
			Dummy 		d;
			DateTime	t1, t2;
			
			while ( true )
			{
				t1 = DateTime.Now;
				
				for ( i = 0; i < 100; i++ )
				{
					for ( j = 0; j < 1000000; j++ )
						d = new Dummy();
				
					Console.Write(".");
				}
				
 				t2 = DateTime.Now;
 				
 				Console.WriteLine();
 				Console.WriteLine("Runtime of {0} * {1} cycles: {2}", i, j, t2 - t1);
 				Console.WriteLine();
			}
		}
	}
}
========================= End of sample code =========================



Joerg Rosenkranz



More information about the Mono-devel-list mailing list