[Mono-list] mono performance on highly recursive functions

Fergus Henderson fjh@cs.mu.OZ.AU
Mon, 17 Feb 2003 23:51:21 +1100


On 17-Feb-2003, Paolo Molaro <lupus@ximian.com> wrote:
> On 02/17/03 Fergus Henderson wrote:
> > On 17-Feb-2003, Paolo Molaro <lupus@ximian.com> wrote:
> > > Detecting tail-recursion is easy and performing tail recursion
> > > elimination should not be difficult in the new JIT, maybe one of these
> > > days I'll have a look at doing it, but it's not an high priority
> > > for me right now.
> > 
> > It might be better to do this optimization in the language front-ends,
> > or in an IL-to-IL optimizer, rather than in the JIT.
> 
> I plan to do it in the IL -> high-level-intermediate-representation pass
> in the JIT. I don't know what would be the advantages for doing that in
> every language frontend if you can do it just once in the JIT, it's not
> the kind of optimization that requires much processing time.

There are lots of other optimizations which can be done at the IL->IL
level, many of which *do* require lots of processing time.  To avoid
duplicating these optimizations in multiple language front-ends, it makes
sense to have an IL->IL optimization tool.  Then you can do it once
in the IL->IL optimization tool, at zero run-time cost, rather than doing
it in the JIT at a small but non-zero cost in time and working set size
(due to the code for detecting when this optimization can be applied)
at run-time.

The IL->IL optimizations should probably be packaged as part of the IL
assembler (`ilasm -O').

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.