[JW Lua] Performance problem with FCSmartShapeMeasureMarks:LoadAllForRegion()
Jan Angermüller
jan at angermueller.com
Sat Jan 3 16:44:02 CET 2015
Jari,
I've got a performance problem when loading the collection of
FCSmartShapeMeasureMarks.
The function marks:LoadAllForRegion(region) - with region set to
FullDocument -
took some seconds (or even a minute !) to perform on a huge score.
Even if the region was set to less than the full document, it still took
a few seconds.
When using marks:LoadAll(), it only took 0.01s on the same score.
See the test script and its output below.
I tested it on several scores and the factor of performance difference
between LoadAllForRegion and LoadAll varied between 68 on small scores and
1024 (!) on large or huge scores.
I think LoadAllForRegion should have a tiny overhead compared to LoadAll
when
the region is set to the full document. But that should disappear
immediately
when only parts of the document are selected. A factor of more than 4 in
performance difference seems unrealistic to me. And more than 1000 seems
very strange.
I also played around with the second optional parameter of
LoadAllForRegion (i.e. removeduplicates ),
but that didn't have any influence.
The first time I noticed this problem was on a script that called
marks:LoadAllForRegion(region) 6 times
and which took more than 30 seconds to run, although there were no major
operations afterwards.
When I changed it to LoadAll() and added an if-clause for checking
if the mark was within the measure range of the selected region, it took
far less than a second to run.
So there is probably a performance problem with
FCSmartShapeMeasureMarks:LoadAllForRegion(...).
Jan
function PrintClock(text)
newclock=os.clock()
print(text, string.format("elapsed time: %.3fs\n", newclock -
lastclock))
lastclock=newclock
end
local marks = finale.FCSmartShapeMeasureMarks()
local tempregion=finale.FCMusicRegion()
tempregion:SetFullDocument()
lastclock=os.clock()
newclock=lastclock
marks:LoadAllForRegion(tempregion, false)
print("Number of marks:", marks.Count)
PrintClock("LoadAllForRegion")
marks:LoadAll()
print("Number of marks:", marks.Count)
PrintClock("LoadAll")
*Large Orchestral Score*:
Running [Unnamed Script] ======>
Number of marks: 5855
LoadAllForRegion elapsed time: 5.79s
Number of marks: 5855
LoadAll elapsed time: 0.006s
<======= [Unnamed Script] succeeded (Processing time: 5.800 s).
*Factor: **965*
*Huge Orchestral Score*:
Running [Unnamed Script] ======>
Number of marks: 28380
LoadAllForRegion elapsed time: 45.064s
Number of marks: 28380
LoadAll elapsed time: 0.044s
<======= [Unnamed Script] succeeded (Processing time: 45.108 s).
*Factor: 1024*
*Small Orchestral Score*:
Running [Unnamed Script] ======>
Number of marks: 1476
LoadAllForRegion elapsed time: 0.204s
Number of marks: 1476
LoadAll elapsed time: 0.003s
<======= [Unnamed Script] succeeded (Processing time: 0.207 s).
*Factor: 68*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150103/c383dee8/attachment.htm>
More information about the JWLua
mailing list