[Mono-dev] Remoting implementation question - calls on System.Object

Robert Jordan robertj at gmx.net
Mon Aug 14 16:57:20 EDT 2006


Hey,

Brian Crowell wrote:
> Hey, here's a question-- does the remoting framework in Mono forward 
> System.Object calls on MarshalByRefObjects? I'm looking at a stack trace that 
> suggests it does, in which case, that could be a major source of your 
> performance problems in XSP.

Indeed, it does forward the calls, even if the methods are
not overloaded.

Here is what MS does:

	http://msdn2.microsoft.com/en-us/library/h8f0y3fc.aspx

This timing test case reveals the forwarding:

using System;
using System.Reflection;

class Server : MarshalByRefObject
{
         static void Main ()
         {
                 AppDomain ad = AppDomain.CreateDomain ("foo");

		Server s = (Server) ad.CreateInstanceAndUnwrap 
(Assembly.GetExecutingAssembly ().FullName, typeof (Server).FullName);

		TimeIt (new object ()); // lasts almost nothing
		TimeIt (s);             // lasts a couple of secs
         }

	static void TimeIt (object o)
	{
		DateTime b = DateTime.Now;
		for (int i = 0; i < 100000; i++)
			o.Equals (null);
		Console.WriteLine (DateTime.Now - b);
	}
}


Please file a bug.

Robert




More information about the Mono-devel-list mailing list