[SVN] Re: ActionScript Bundle

Chris Thomas chris at cjack.com
Mon Feb 28 06:08:30 UTC 2005


On Feb 27, 2005, at 7:25 PM, Chris Thomas wrote:

> On Feb 27, 2005, at 5:00 PM, Roger Braunstein wrote:
>
>>  I like how a lot of the bundles use applescript to do some of the 
>> GUI dirty work -- particularly impressed with HTML > Colorpicker....
>
> Yes, but it's slow. Very, very, very slow. On a Dual 2 GHz G5, it 
> takes 4 seconds to do a cold open of the color picker using that 
> command. Immediate repeated use is more like 1 or 2 seconds, which is 
> still high for a G5.
>
> It might be interesting to use fs_usage and Shark to see where that 
> time goes. I suspect it's mostly spent instantiating AppleScript.

I got curious.

1. Terminal: sudo fs_usage -w -f filesys -e [insert pid for Terminal] > 
opencolorpicker.txt
2. Switch to TM, run Colorpicker and wait until the color picker 
appears.
3. Switch to Terminal: control-c out of fs_usage
4. cat opencolorpicker.txt | perl -pe 's/.*\s(\w+)(\s*)$/$1\n/' | sort 
| uniq | awk '{print ("grep -e " $0 "$ opencolorpicker.txt | echo " $0 
": `wc -l`")}' | sh

This will give you a list of the number of times each running command 
hit the filesystem in some way (open, close, read, write, stat, etc).

Counting fs_usage lines is a very coarse way to measure the cost of 
file system operations, not every operation is identical in cost, and 
some data may be cached, etc.

Regardless, note the size of the osascript number relative to the other 
numbers, and then look at "opencolorpicker.txt" and note the number of 
osascript lines that are dedicated to telling the Finder to choose a 
color versus those that are OSA startup overhead. I did measure on 
Tiger; I'd be very surprised if the results were much different on 
Panther.

Chris




More information about the textmate-dev mailing list