Script runs 3 times faster within Script Editor than as an application

Hi,
I have written a moderately complicated script that has calls to two different applications. The script runs about 3 times faster from within Script Editor than it does when saved out as a standalone application. One thing I have noticed is that in my code, I wrapped some calls to the one application within calls to the other. For example:

tell application “blah”
do some stuff
tell application “whatever”
do some more stuff
end tell
end tell

Would this be part of the problem? And are there any other things I should be looking for to speed things up? Thanks.

In this very general format, it’s unlikely that folks will know how to answer this.

is any of the things that you are asking one of the applications to do, take a fair amount of time. What I mean by that, is more than a second.

Kevin

Here is a sample snippet of code. It takes 12 seconds to run in Script Editor and 24 seconds as a standalone application. Any tips to speed the standalone up?

set startTime to current date
tell application "MultiAd Creator Pro"
	try
		set docProps to properties of document 1
	on error
		display dialog "There must be a Creator document open in order to use this script." buttons {"OK"} default button 1 giving up after 0 with icon 0
		return
	end try
	tell docProps
		set fontsUsed to fonts used
		set folderPath to folder
	end tell
	set folderPath to folderPath as text
	if folderPath is "" then
		display dialog "This Creator document must be saved before using this script." buttons {"OK"} default button 1 giving up after 0 with icon 0
		return
	end if
	set graphicItems to every graphic element of page 1 of document 1
	set graphicItems to reverse of graphicItems
	set pasteBoardx to x of pasteboard size of docProps
	set pasteBoardY to y of pasteboard size of docProps
	set pageProps to properties of page 1 of document 1
	tell size of pageProps
		set pageWidth to x
		set pageDepth to y
	end tell
end tell
tell application "InDesign CS"
	tell view preferences
		set horizontal measurement units to points
		set vertical measurement units to points
	end tell
	tell margin preferences
		set priorTop to top
		set priorBottom to bottom
		set priorLeft to left
		set priorRight to right
		set top to 0
		set bottom to 0
		set left to 0
		set right to 0
	end tell
	tell document preferences
		set priorPages to pages per document
		set priorFacing to facing pages
		set priorHeight to page height
		set priorWidth to page width
		set page height to ((pageDepth as text) & " pt")
		set page width to ((pageWidth as text) & " pt")
		set pages per document to 1
		set facing pages to false
	end tell
	tell pasteboard preferences
		set priorMaxWidthPasteboard to minimum space above and below
		set maxWidthPasteboard to pasteBoardx
		if pasteBoardY > pasteBoardx then set maxWidthPasteboard to pasteBoardY
		set minimum space above and below to maxWidthPasteboard
	end tell
	tell display performance preferences
		set default display settings to high quality
	end tell
	activate
	set newDocument to make new document
	tell layout window 1 to set transform reference point to top left anchor
	tell margin preferences
		set top to priorTop
		set bottom to priorBottom
		set left to priorLeft
		set right to priorRight
	end tell
	tell document preferences
		set pages per document to priorPages
		set page height to priorHeight
		set page width to priorWidth
		set facing pages to priorFacing
	end tell
	tell pasteboard preferences
		set minimum space above and below to priorMaxWidthPasteboard
	end tell
end tell

repeat with oneGraphic in graphicItems
	tell application "MultiAd Creator Pro"
		tell oneGraphic
			set graphicFlipped to flipped
			set graphicSkew to skew angle
			set graphicRotation to rotation
			set graphicScale to scale
			set graphicXScale to x of graphicScale
			set graphicYScale to y of graphicScale
			set graphicBounds to bounds
			set graphicTop to top of graphicBounds
			set graphicLeft to left of graphicBounds
			set graphicBottom to bottom of graphicBounds
			set graphicRight to right of graphicBounds
			set graphicWidth to width
			set graphicDepth to height
			set graphicPath to file alias
			set graphicCropping to cropping
			set topCrop to top of graphicCropping
			set leftCrop to left of graphicCropping
			set bottomCrop to bottom of graphicCropping
			set rightCrop to right of graphicCropping
			set graphicUncroppedWidth to graphicWidth * (100 / (rightCrop - leftCrop))
			set graphicUncroppedDepth to graphicDepth * ((100 / bottomCrop - topCrop))
		end tell
		set topCropDim to graphicUncroppedDepth * (topCrop / 100)
		set leftCropDim to graphicWidth * (leftCrop / 100)
		set bottomCropDim to graphicUncroppedDepth - (graphicUncroppedDepth * (bottomCrop / 100))
		set rightCropDim to graphicUncroppedWidth - (graphicUncroppedWidth * (rightCrop / 100))
	end tell
	tell application "InDesign CS"
		tell document 1
			tell page 1
				set newInDesignObject to place graphicPath with properties {horizontal scale:graphicXScale, vertical scale:graphicXScale, geometric bounds:{graphicTop - topCropDim, graphicLeft - leftCropDim, graphicBottom + bottomCropDim, graphicRight + rightCropDim}}
				set geometric bounds of (parent of newInDesignObject) to {graphicTop, graphicLeft, graphicBottom, graphicRight}
			end tell
		end tell
	end tell
end repeat
set elapsedTime to ((current date) - startTime)
activate me
display dialog "Finished in " & elapsedTime & " seconds."