[JW Lua] Very slow calculation of CalcWidestNoteheadWidth under one-bar repeat staff style

Jan Angermüller jan at angermueller.com
Thu Sep 10 21:13:12 CEST 2015


Hi Jari,

I noticed a strange "slow motion" calculation when performing 
FCNoteEntry:CalcWidestNoteheadWidth() on a measure with a "one-bar 
repeat" staff style, i.e. where the noteheads are not visible.

This is the simple script:

for entry in eachentry(finenv.Region()) do
   local n=entry:CalcWidestNoteheadWidth()
end

When running this script on one measure with 24 noteheads, it takes 
0.067s for a measure without a staff style and 0.368 (!) seconds if none 
of the noteheads is visible as it is hidden beyond the*one-bar repeat 
staff style*. So if you take 30 one-bar repeat measures, it sums up to 
*11 seconds* (!) for calculating 720 notehead widths on a fast PC.
My current workaround is: if some entrymetrics properties return 0 (i.e. 
the position can't be calculated as it is hidden), then don't calculate 
the notehead width.
But probably you will find a better internal solution.

The same goes for the*two-bar repeat and blank notation with empty rests 
*staff styles.
The other alternate notations work fine (i.e. 0.067s calculating time 
for slash, rhythmic and blank notation).

All the best,
Jan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150910/23df804a/attachment-0002.html>


More information about the JWLua mailing list