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

Varga Zoltan vargaz at freemail.hu
Fri May 30 09:08:12 EDT 2003


                                                Hi,

   The current allocation path is not very optimized under
mono. It
involves the following:
- A call to the icall wrapper for mono_object_new_specific.
- A call to mono_object_new_specific
- A call to mono_object_new_alloc_specific
- A call to GC_MALLOC
- A call to mono_profiler_allocation
+ a few comparisons etc.

It would be easy to create an optimized version for the common
case (no profiler, no remoting etc.). I could do this if
there is interest.

                                       bye

                                          Zoltan



Jörg Rosenkranz <joergr at voelcker.com> írta:

> 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
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 
> 







More information about the Mono-devel-list mailing list