osascript has problems with compound whose | where queries on Applescript/JavaScript for Applications object collections

Originator:peter
Number:rdar://21759799 Date Originated:10-Jul-2015 10:19 AM
Status:Open Resolved:
Product:OS X Product Version:10.10.4
Classification:Usability/Performance Reproducible:Always
 
Summary:
The attached scripts (AS and JXA) execute in a few milliseconds in Yosemite Script Editor, but each takes a full 6 seconds ( 2ms vs 6000+ ms ) when executed via osascript.

~/Desktop $ time osascript osascriptWHOSE_clause_bugAS.scpt
«class pcap» TextEdit, «class pcap» com.apple.appkit.xpc.openAndSavePanelService

real	0m6.118s
user	0m0.023s
sys	0m0.018s

~/Desktop $ time osascript osascriptWHOSE_clause_bugJS.scpt
Application("System Events").applicationProcesses.byName("TextEdit").windows.byName("Untitled 3"), Application("System Events").applicationProcesses.byName("TextEdit").windows.byName("Untitled 2"), Application("System Events").applicationProcesses.byName("TextEdit").windows.byName("Untitled")

real	0m6.109s
user	0m0.056s
sys	0m0.024s

Steps to Reproduce:
See discussion:

http://forum.keyboardmaestro.com/t/script-performance-script-editor-vs-km-app-wins-vs-km-palettes/1534/4

Expected Results:


Actual Results:


Version:
10.10.4

Notes:


Configuration:


Attachments:
'osacriptCompoundWHOSEclauseBug.zip' was successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!