[Mono-devel-list] System.Reflection Performance

Joshua Tauberer tauberer at for.net
Tue Jan 6 13:45:46 EST 2004


Paolo Molaro wrote:
> Maybe the only good advice wrt performance is: use the profiler or
> otherwise time your application code and see the actual numbers

I was curious about all of this so I tried it myself.  But, I got 
something I don't understand.

My test program is this:

string x = "123";
for (int i = 0; i < 10000000; i++)
	bool c = x == "";

mono --profile test.exe  shows:

  12476.454 10000000    0.001  System.String::op_Equality(string,string)
   Callers (with count) that contribute at least for 1%:
     10000000  100 % .main::Main(string[])
########################
  3297.479 10000000    0.000  System.String::Equals(string,string)
   Callers (with count) that contribute at least for 1%:
     10000000  100 % System.String::op_Equality(string,string)

 From which I understand 12sec was spent in op_Equality and 3sec in 
Equals.  But, Equals is only called from op_Equality, and all 
op_Equality does is call Equals, so where are the other 9 seconds in 
op_Equality attributed to? Is that the overhead of calling a method, or 
the overhead of profiling, or something else?

-- 
- Joshua Tauberer

http://taubz.for.net

** Nothing Unreal Exists **






More information about the Mono-devel-list mailing list