The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   V6 Applescript much slower than V5 (http://forums.omnigroup.com/showthread.php?t=30822)

RobTrew 2013-09-25 07:42 PM

V6 Applescript much slower than V5
 
I am finding that Applescripts run glutinously slowly on V6.

About 8 times slower on V6 is not untypical, with execution speeds that mean that some of the scripts I use daily – changing the layout and format of reasonably large tree diagrams for example – are not really usable on V6 at the moment.

Is there any prospect of V6 catching up with something closer to V5 execution speeds ?

(or has there perhaps been some architectural change related to the sandboxing environment ? If so, V5 may become a valuable vintage edition ...)

Ken Case 2013-09-25 08:26 PM

Before we shipped, Tim spent some time improving the performance of the script you sent in OG #948637 and by the end of his tuning (in r194894) he had it running several times faster in OmniGraffle 6 than it was in OmniGraffle 5:
[INDENT]OG 5: 61s
OG 6: 14s[/INDENT]
If you're seeing slow performance with some other use cases, we might need more data so we can tune those as well. (We saw some other opportunities for improving performance over the last few days, but didn't want to risk destabilizing the app as we approached the 6.0 release.)

RobTrew 2013-09-26 12:04 AM

Sounds good, but did any of Tim's optimisations make it into the current download ?

The build I downloaded last night (195588 ) is nearly 10 times slower than V5 in moving the diagram which I showed in the post on auto-layout, using the simple script below (which is, I think, the script you referred to above).

[CODE]property pTitle : "Move selected graphics to centre of 1st canvas page"
property pVer : "0.02"
property pAuthor : "Robin Trew"

--CENTRE THE SELECTED BLOCK OF GRAPHICS ON THE FIRST PAGE OF THE OMNIGRAFFLE CANVAS

on run
tell application id "OGfl"


try
tell front window to set {oCanvas, lstSeln} to {its canvas, selection}
on error
return
end try

-- FIND THE CENTRE OF THE SELECTION(S)

-- Find horizontal and vertical minima and maxima of the selected shapes
set {rXMin, rXMax, rYMin, rYMax} to {10 ^ 6, 0, 10 ^ 6, 0}
repeat with oGraphic in lstSeln
tell oGraphic to set {{rX, rY}, {rAcross, rDown}} to {origin, size}
set {rRight, rBottom} to {rX + rAcross, rY + rDown}

if rX < rXMin then set rXMin to rX
if rRight > rXMax then set rXMax to rRight
if rY < rYMin then set rYMin to rY
if rBottom > rYMax then set rYMax to rBottom
end repeat

-- and derive an aggregate centre of the selected shapes
set {rMidSeln_X, rMidSeln_Y} to {(rXMin + (rXMax - rXMin) / 2), (rYMin + (rYMax - rYMin) / 2)}

-- GET THE X,Y DELTAS BETWEEN THE SELECTION(s) CENTRE AND THE PAGE CENTRE
tell oCanvas to set {rPageAcross, rPageDown} to page size
set {rDeltaX, rDeltaY} to {(rPageAcross / 2) - rMidSeln_X, (rPageDown / 2) - rMidSeln_Y}

-- TRANSLATE THE POSITION OF EACH SELECTED SHAPE
repeat with oGraphic in lstSeln
tell oGraphic
set {rX, rY} to origin
set origin to {rX + rDeltaX, rY + rDeltaY}
end tell
end repeat
end tell
end run
[/CODE]

RobTrew 2013-09-27 01:38 AM

Still no Applescript performance improvement in r195805 at
[INDENT][url]http://omnistaging.omnigroup.com/omnigraffle-6/[/url][/INDENT]
Testing with a scripted diagram repositioning (script above):
[INDENT]OmniGraffle 5: 0.65s
OmniGraffle 6: 6.4s[/INDENT]
Still too slow to use, in practice.

RobTrew 2013-09-29 03:34 AM

1 Attachment(s)
A little puzzled by Ken's repetition on Twitter of the claim that V6 Applescript was speeded up (for my test script) before the 6.0 release.

I am simply not seeing the improvements which he reports – even in r195921 V6 is still running the same test script that Ken refers to nearly 10 times slower than V5.
[LIST][*]Perhaps there is some confusion about whether the reported optimisations were actually merged into the main build or not ?[*]or perhaps a cross-labelling confusion about which version is running scripts slowly, and which at a reasonable speed ?[/LIST]
Script and test file attached herewith, for anyone who would like to run the test.

(Select the whole diagram, and run the script to centre it on the first page of the canvas).

Note that to recompile the script for a different version of OG you will need to close the other OG version, apply a trivial spacing edit to the script, and save it again.

RobTrew 2013-09-29 06:26 AM

[QUOTE=RobTrew;127605]Note that to recompile the script for a different version of OG you will need to close the other OG version, apply a trivial spacing edit to the script, and save it again.[/QUOTE]

Or make one version which reads:

[CODE]-- V6 test build (OmniGraffle > Free Trial Mode > Try Pro Edition)
tell application id "com.omnigroup.OmniGraffle6"
...
end tell[/CODE]

and another which reads:
[CODE]-- V5 Pro
tell application id "com.omnigroup.OmniGrafflePro"
...
end tell[/CODE]

derekr 2013-09-30 09:35 AM

Rob, I think we may have a fix for this in the next test build.

RobTrew 2013-09-30 10:14 AM

Thanks.

It seems unfortunate not only to have gone to release with a version that is running Applescripts nearly 10 times slower than V5, but actually to have claimed a speed improvement ...


All times are GMT -8. The time now is 09:54 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.