Im randomly experiencing a big slowdown in my code.. but I fail see where and 
what is causing this slowdown. Advices on how to move on are appreciated.

Im writing a text editor which can do syntax colorering of Ruby code.
recomputing all 50 lines takes about 0.09 - 0.15 seconds.

However when inserting one letter.. so that only one line is recomputed,
then it takes between 0.03 - 0.43 seconds!   Im interested in hunting down 
why it often spends so long time computing just a single line. 

I have 
1) profiled the recomputing of all 50 lines and 
2) profiled the recomputing of a single line when speed is bad and
3) profiled the recomputing of a single line when speed is good.

when I compare the profiler output, I fail to see where the slowdown are.

You may see the output here:
http://aeditor.rubyforge.org/wiki/wiki.pl?ProfilingLexerNew

The place where I recompute is in the method #sync_lcache in this file
http://rubyforge.org/cgi-bin/viewcvs/cgi/viewcvs.cgi/projects/experimental/buffer/source/buffer.rb?rev=1.2.2.11&cvsroot=aeditor&only_with_tag=b20040707&content-type=text/vnd.viewcvs-markup


I have inserted the following code around the place where I recompute

Profiler__.start_profile 
# code to profile
Profiler__.stop_profile
Profiler__.print_profile(STDOUT) 


If you have any ideas why the recomputation of a single line
takes unnecessary long time.. then please contact me.

How can I identify what sometimes is causing this slowdown?

--
Simon Strandgaard