<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Jari,<br>
<br>
I've got a performance problem when loading the collection of
FCSmartShapeMeasureMarks.<br>
<br>
The function marks:LoadAllForRegion(region) - with region set to
FullDocument -<br>
took some seconds (or even a minute !) to perform on a huge score. <br>
Even if the region was set to less than the full document, it still
took a few seconds.<br>
When using marks:LoadAll(), it only took 0.01s on the same score.<br>
<br>
See the test script and its output below.<br>
<br>
I tested it on several scores and the factor of performance
difference<br>
between LoadAllForRegion and LoadAll varied between 68 on small
scores and <br>
1024 (!) on large or huge scores.<br>
I think LoadAllForRegion should have a tiny overhead compared to
LoadAll when<br>
the region is set to the full document. But that should disappear
immediately<br>
when only parts of the document are selected. A factor of more than
4 in<br>
performance difference seems unrealistic to me. And more than 1000
seems very strange.<br>
<br>
I also played around with the second optional parameter of
LoadAllForRegion (i.e. removeduplicates ),<br>
but that didn't have any influence.<br>
<br>
The first time I noticed this problem was on a script that called
marks:LoadAllForRegion(region) 6 times<br>
and which took more than 30 seconds to run, although there were no
major operations afterwards.<br>
When I changed it to LoadAll() and added an if-clause for checking<br>
if the mark was within the measure range of the selected region, it
took far less than a second to run.<br>
So there is probably a performance problem with
FCSmartShapeMeasureMarks:LoadAllForRegion(...).<br>
<br>
Jan<br>
<br>
<br>
function PrintClock(text)<br>
newclock=os.clock()<br>
print(text, string.format("elapsed time: %.3fs\n", newclock -
lastclock))<br>
lastclock=newclock<br>
end<br>
<br>
local marks = finale.FCSmartShapeMeasureMarks()<br>
local tempregion=finale.FCMusicRegion()<br>
tempregion:SetFullDocument()<br>
lastclock=os.clock()<br>
newclock=lastclock<br>
<br>
marks:LoadAllForRegion(tempregion, false)<br>
print("Number of marks:", marks.Count)<br>
PrintClock("LoadAllForRegion")<br>
<br>
marks:LoadAll()<br>
print("Number of marks:", marks.Count)<br>
PrintClock("LoadAll")<br>
<br>
<b>Large Orchestral Score</b>:<br>
Running [Unnamed Script] ======><br>
Number of marks: 5855<br>
LoadAllForRegion elapsed time: 5.79s<br>
Number of marks: 5855<br>
LoadAll elapsed time: 0.006s<br>
<======= [Unnamed Script] succeeded (Processing time: 5.800 s).<br>
<b>Factor: </b><b>965</b><br>
<br>
<b>Huge Orchestral Score</b>:<br>
Running [Unnamed Script] ======><br>
Number of marks: 28380<br>
LoadAllForRegion elapsed time: 45.064s<br>
Number of marks: 28380<br>
LoadAll elapsed time: 0.044s<br>
<======= [Unnamed Script] succeeded (Processing time: 45.108 s).<br>
<b>Factor: 1024</b><br>
<br>
<b>Small Orchestral Score</b>:<br>
Running [Unnamed Script] ======><br>
Number of marks: 1476<br>
LoadAllForRegion elapsed time: 0.204s<br>
Number of marks: 1476<br>
LoadAll elapsed time: 0.003s<br>
<======= [Unnamed Script] succeeded (Processing time: 0.207 s).<br>
<b>Factor: 68</b><br>
</body>
</html>