gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More optimisation


From: David Chisnall
Subject: More optimisation
Date: Mon, 3 May 2010 12:47:01 +0100

Over the weekend, I committed a few more passes:

    -gnu-class-imp-cache

Adds IMP caching for all message sends to classes.  Roughly halves the cost of 
class message sends.

    -gnu-class-lookup-cache

Avoids the class lookup in class message sends.  Makes the time spent for 
sending 100,000,000 class messages drop from 56 seconds to 10 on my machine.

    -gnu-class-method-inline

Attempts to inline class methods and method calls to super.  If successful, 
eliminates the cost of a call.  When combined with IMP caching makes a class or 
super message send cheaper than a (non-inline) C function call.  This works 
best as a link-time optimisation.

    -gnu-loop-imp-cache

Adds IMP caching to all message sends in loops.

    -gnu-nonfragile-ivar

Eliminates the double-indirection of non-fragile ivars that's required for GCC 
compatibility if the ivar was in a class compiled with clang.  Eliminates the 
indirect ivar lookup entirely if all of the superclasses are in this 
compilation unit (meaning that the ivar offset can only change if you recompile 
the module).  This works best as a link-time optimisation.

    -gnu-objc-type-feedback                    - Objective-C type feedback for 
the GNU runtime.

Adds profiling to all message sends (actually, to all calls to functions via 
pointer) recording what was actually called.

    -gnu-objc-feedback-driven-inline           - Objective-C type 
feedback-driven inliner for the GNU runtime.

Inlines calls based on the profiling info generated by the previous pass.  This 
lets you speculatively inline calls to methods where the same method is called 
most of the time at a particular call site.  

It's probably too much effort to run the profile-driven pass on most code, but 
it might be useful for anything that's really CPU-bound.  It's also possible 
that we could get some performance increase across the board by compiling -base 
with profiling enabled, run the test suite, and then recompile -base using the 
profiling info.  

It will also be used in LanguageKit soon, so Smalltalk code is run in the JIT 
initially with profiling enabled, then static compiled using the profiling 
info.  LK automatically drops back to JIT mode and recompiles the static 
version if any frameworks have been modified, so it would be really great if we 
could include the bitcode for frameworks in the bundle somewhere - then LK 
could inline methods from there too.

It would be really great to have some support in GNUstep Make for running these 
automatically...

David

-- Sent from my Difference Engine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]