At 10:55 am -0800 12/1/04, Chris Nandor wrote:


The script I just posted took 3.263 seconds, including hitting "Cancel" to
make the dialog box go away, on a PowerBook G4/867 running Panther.  Total
user/sys time was 1.39 seconds.  Pain is highly dependent on your system
specifics and pain threshhold.

I have exactly the same set-up. The only difference seems to be my pain threshold :-)


In my experience, Panther is quite a bit faster with Mac::Carbon startup
than Jaguar was.  I've got some benchmarks I keep meaning to clean up and
post.  The time spent in dyld has -- the biggest problem -- has been
dramatically reduced.

The problem with your routine is that you need to display the dialog in a process which a) has glue available and b) the user does not want to activate.


Besides that, the user is required to learn a new way of expressing the terminology rather than simply using the familiar AppleScript way.

The routine using Mac::AppleScript seems so much simpler to me and it is possible to display dialogs without leaving the current application, whether it be Terminal or the editor (at least the one I'm using). RunAppleScript requires the learning of one simple command, allows the scripts to be easily debugged in an AppleScript editor and simply pasted into the Perl script. As to speed, I have done no precise timings. Neither method is fast and 3 seconds to me is an awful long time if you think what that might have taken on a 66 MHz machine. I don't pretend to understand the low-level stuff, but I know Panther does a lot of basic things more slowly than a Mac Plus.


use Mac::AppleScript qw(RunAppleScript); $asresult = RunAppleScript <<AS; tell app "Terminal" display dialog "Enter a number:" default answer "55" text returned of result as real end AS print $asresult**2 . $/;




Reply via email to