The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
V6 Applescript much slower than V5 Thread Tools Search this Thread Display Modes
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 ...)
 
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:
OG 5: 61s
OG 6: 14s
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.)
 
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
 
Still no Applescript performance improvement in r195805 at
http://omnistaging.omnigroup.com/omnigraffle-6/
Testing with a scripted diagram repositioning (script above):
OmniGraffle 5: 0.65s
OmniGraffle 6: 6.4s
Still too slow to use, in practice.
 
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.
  • 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 ?

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.
Attached Files
File Type: zip ScriptAndTestFile.zip (6.5 KB, 380 views)
 
Quote:
Originally Posted by RobTrew View Post
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.
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
and another which reads:
Code:
-- V5 Pro
tell application id "com.omnigroup.OmniGrafflePro"
...
end tell
 
Rob, I think we may have a fix for this in the next test build.
 
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 ...
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -8. The time now is 09:51 PM.


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