現在、Sidekick DictionaryをUnix commandを使って全面的に書き直しています。相当な速度差があるようで、以下の例はよく紹介されているURL accessingを使ってファイルをダウンロードした場合とcurlを使った場合の速度を比較するサンプルです。
curlを使うことで処理時間が約半分になっています。文字列処理ではもっと差が出ます…
初めからコマンドセットを用意してください … Appleさん!
------------------------------------------------------------------------
set aFolderPath to ((path to desktop) as string)
set aFileName to "Oops.html"
set aURL to "http://www.apple.com/"
set a1 to current date
--- Old ways .....
repeat 3 times
downloadFrom1(aURL, aFolderPath, aFileName)
end repeat
set a2 to current date
--- Unix Power!
repeat 3 times
downloadFrom2(aURL, aFolderPath, aFileName)
end repeat
set a3 to current date
return {(a2 - a1) / 3, (a3 - a2) / 3} -- { 通常、Unixを使用した場合}
--Old ways
on downloadFrom1(aURL, aFolderPath, aFileName)
set aFullPath to ((aFolderPath as string) & aFileName)
tell application "URL Access Scripting"
launch
activate
download aURL to file aFullPath replacing yes with progress
quit
end tell
return ""
end downloadFrom1
-- See Unix Power?
on downloadFrom2(aURL, aFolderPath, aFileName)
set aDir to "cd " & quoted form of (POSIX path of (aFolderPath))
set aScript to (aDir & "; " & " curl -o " & aFileName & " " & "'" & aURL & "'")
set aStatus to do shell script aScript
return aStatus
end downloadFrom2
curlを使うことで処理時間が約半分になっています。文字列処理ではもっと差が出ます…

------------------------------------------------------------------------
set aFolderPath to ((path to desktop) as string)
set aFileName to "Oops.html"
set aURL to "http://www.apple.com/"
set a1 to current date
--- Old ways .....
repeat 3 times
downloadFrom1(aURL, aFolderPath, aFileName)
end repeat
set a2 to current date
--- Unix Power!
repeat 3 times
downloadFrom2(aURL, aFolderPath, aFileName)
end repeat
set a3 to current date
return {(a2 - a1) / 3, (a3 - a2) / 3} -- { 通常、Unixを使用した場合}
--Old ways
on downloadFrom1(aURL, aFolderPath, aFileName)
set aFullPath to ((aFolderPath as string) & aFileName)
tell application "URL Access Scripting"
launch
activate
download aURL to file aFullPath replacing yes with progress
quit
end tell
return ""
end downloadFrom1
-- See Unix Power?
on downloadFrom2(aURL, aFolderPath, aFileName)
set aDir to "cd " & quoted form of (POSIX path of (aFolderPath))
set aScript to (aDir & "; " & " curl -o " & aFileName & " " & "'" & aURL & "'")
set aStatus to do shell script aScript
return aStatus
end downloadFrom2
※コメント投稿者のブログIDはブログ作成者のみに通知されます