Based on this observation, I'll be using the latter statement above, when needed, to make my AppleScripts more utilization friendly and cooperative.
|
|
|
I needed to put a short pause into an AppleScript I was writing. I first used a delay 10 statement to wait 10 seconds. I noticed, however, that processor utilization went up to near 100% for the 10 seconds. I switched to a do shell script "sleep 10" statement, and processor utilization remained virtually unchanged during the sleep period.
Based on this observation, I'll be using the latter statement above, when needed, to make my AppleScripts more utilization friendly and cooperative.
•
[13,297 views]
Hint Options
Actually a bug
That's a good hint for AppleScript programmers, but actually I consider this a bug that you should report to Apple. A built-in command that simply waits 10s shouldn't use any, let alone that much CPU.
Actually a bug
ditto
Actually a bug
Believe it or not, this is still a bug in 10.3.9 and 10.4.2.
Curious
I was curious about this, so I ran a simple AppleScript...
Definitely a bug
If it eats 100% cpu, the 'delay' command in AppleScript is busy-waiting instead of , well, using the UNIX sleep() function which is designed for cases like this.
Simple Fix
They could make 'delay' an alias for 'sleep'. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.27 seconds |
|