Thursday, April 13, 2006

Profiling and Optimisation

I've managed to spend some time profiling. It turns out that it makes things much easier if everything is put in a package - then you can do slime-profile-package rather than fiddling with profiling each function individually.

The first results shows that we're spending most of our time talking through CFFI to get values of variables. This turned out to be mostly things like *font* and *mouse-x*. So I've added a system to allow easy updating of these variables through a couple of macros - define-updateable-var and update-var that uses the symbol plist to record a function to execute when updating the variable. Now I only calculate colors on initialisation and grab the updated version of things like *mouse-x* once per frame. This has resulted in much better performance - the fan on my laptop doesn't turn on while running it anymore and it seems to hover around 30% of CPU usage. I've also inlined draw-cell which made quite a big difference.

The new profile shows a much more evenly distributed set of function calls.




I'm going to be spending some time now playing around with cl-emb and cl-who to generate a photo-album style website.

3 Comments:

Anonymous Anonymous said...

how are you creating these images form the slime profiler?

7:19 pm  
Blogger Damyan said...

By manipulating the output from the profiler in emacs a bit, then pasting it into Excel and turning it into a pie chart. Nothing too fancy, I'm afraid!

9:35 am  
Anonymous Anonymous said...

how do you use the slime-profile-package command in slime? it just keeps saying SYSTEM::MAP-SYMBOLS: There is no package with name "NIL"
[Condition of type SYSTEM::SIMPLE-PACKAGE-ERROR]

1:41 pm  

Post a Comment

<< Home