Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript that may give OS X a speed boost' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript that may give OS X a speed boost
Authored by: robmorton on Apr 01, '03 10:59:24AM

Am I missing something. What is the purpose of the tell application "Terminal" part. do shell script is not part of the Terminal's library. do script is, but just looking at the script, I do not see why you would want to open the Terminal instead of doing this in the background. Maybe I am overlooking the obvious though.



[ Reply to This | # ]
An AppleScript that may give OS X a speed boost
Authored by: noblee on Apr 01, '03 11:30:28AM
OK, well all UNIXes have some program to set the priority for each operation. In BSD and Linux and others, this is the nice command. feel free to play with this, but don't change the kernel's nice value! anyway, nice values are in the range [-20...20] with -20 being the highest priority. Basically, if you
sudo nice -n 20 /Applications/Mail.app/Contents/MacOS/Mail
your Mail will be the highest priority task on your box (this is a bad idea, as you might be checking mail and your system might want to use a diskdrive and not be able to as Mail is prioritized). However, if used with restraint, as in this script, it will simply put your programs at a slightly higher priority.

Now, about why he does what he does with the script: you need to tell every method of launching an application or script to be a higher priority. Thus, he needs to tell Finder, Dock, Terminal, etc to be reniced if he wants to get their daughters to run at the new value, e.g., if you launch Word from the Dock, it inherits the nice value from the Dock.

Now, I am hesitant to say this will speed things up on a single user box, though. Nice is a very simple application. Basically, it compares various numbers between every app and whichever has the lowest number is executed first. Most system level processes will still be lower than user processes, thus you should not see a change unless system processes are running in the high values, which is unlikely.

[ Reply to This | # ]

An AppleScript that may give OS X a speed boost
Authored by: robmorton on Apr 01, '03 02:25:22PM

Well, the part I don't get is that tell application "Terminal" is not needed. It just starts for no apparent reason. do shell script ... does not need a Terminal window to be open. Just seemed odd to me. Of course a straight out shell script would be quicker, but these could be added into the Login items by anyone with no Terminal experience.



[ Reply to This | # ]
Yep
Authored by: nick2588 on Apr 04, '03 12:38:56AM
Yes, the tell block is unnessessary in this script, because do shell script is NOT functionality provided by Terminal. The functionality is provided by Standard Additions, and therfore you can use do shell script without a tell block of any kind.

[ Reply to This | # ]
Yep Confirmation
Authored by: nick2588 on Apr 04, '03 12:41:04AM
From http://www.apple.com/applescript/terminal/:

"Note that it is not necessary to use the Terminal application to execute shell scripts. The "Do Shell script" command is part of the pre-installed Standard Additions scripting addition and can be used to communicate with the UNIX shell directly."

[ Reply to This | # ]