BelowCodeDemonstrate the performance of cross-origin access
About 100 times faster than cross-origin ....
Code
Appdomain newdomain = Appdomain. createdomain ( " Remote Application domain " , Null , Null );
Marshalbyreftype local = New Marshalbyreftype ();
Marshalbyreftype remote = (Externalbyreftype) newdomain. createinstanceandunwrap (assembly. getentryassembly (). fullname, " Testconsole. externalbyreftype " );
Stopwatch SW = Null ;
Int Length = 10000000 ;
Int Temp;
SW = Stopwatch. startnew ();
For ( Int I = 0 ; I < Length; I ++ )
{
// Local. setvalue (I );
Temp = Local. getvalue ();
}
Console. writeline (SW. elapsedmilliseconds );
SW = Stopwatch. startnew ();
For ( Int I = 0 ; I < Length; I ++ )
{
// Remote. setvalue (I );
Temp = Remote. getvalue ();
}
Console. writeline (SW. elapsedmilliseconds );
Return ;
Test result in my machine:
101
17532