[Mono-devel-list] patch for StringReader.Read() performance improvement

Ben Maurer bmaurer at ximian.com
Wed Oct 27 08:09:45 EDT 2004


> (It is low-tech solution. Reduced function call
Really, we should be taking advantage of -O=inline. There is no reason to
do an optimization that the jit will be doing later.

One problem is that the call may be trying to do a
remoting-invoke-with-check thingy. If so, that is a bug in the jit
(because when you do it on `this', it should do it without the check.

> to be able to optimize ABCREM).
Exactly how does this work?

The only difference i can see is that you aovid the foo [a++]. Doing that
generates an extra variable in the IL code, which hurts regalloc. copyprop
if you do -O=copyprop,deadce this may get solved (copyprop is another opt
we want to enable for 1.2)

Finally, rather than do:

if (...)
    return -1;
else
    return foo [a++]

do

if (!...)
   return foo [a++];

return -1

This makes sure that the branch in the if is not mispredicted.

-- Ben





More information about the Mono-devel-list mailing list