Replacing AppleScript with Ruby
Subject:   Performance?
Date:   2007-02-28 11:28:15
From:   hhas
Response to: Performance?

Performance varies a bit depending on what you're doing. For example, commands that move a lot of complex data between the application and Ruby tend to be a bit slower, since the conversions are largely done by Ruby code whereas AppleScript is pure C. My own feeling is you can probably expect appscript code to run maybe 30-90% as fast as the equivalent AppleScript code, which in real-world use seems to be "fast enough". Also, Ruby is far, far better at regular programming tasks than AppleScript is, so pretty much everything else needs less code and runs faster than it would in AppleScript, more than balancing things out.

The other thing to bear in mind is that the most significant performance factor is usually the time it takes applications to evaluate queries and respond to commands - something that affects all users equally. While things have improved over the years, the focus of Apple event-based IPC has always been more on power than raw speed. The appscript manual includes some useful advice on eking out the best performance when carrying out more complex tasks.