[JW Lua] ForEachInteger processing speed ? Very slow on high ranges

Jan Angermüller jan at angermueller.com
Sat Dec 19 14:05:06 CET 2015


Jari,

 >It was in the dynamic memory expansion code for the FCString class.
that's good to know !

Could it be that there is also a bottleneck in the output console when 
there are huge amounts (>50.000) of lines to print ?
It only happens the first time when you run the script, i.e. when the 
memory allocation is probably done for the 50.000 lines. For subsequent 
runs the memory is already allocated and the script runs fast.

I don't how the memory allocation takes place. Maybe line by line ?
Probably it would be faster if you allocated the memory for the output 
console in units of 5.000 lines or so. So that you only need 10 memory 
allocation calls for 50.000 lines and not 50.000.
....just an idea.... not so important ... and maybe this is already 
solved with the FCString bottleneck.

A code snippet is below. To get the correct (=slow) results, you need to 
re-start Finale and then start JW Lua. If JW Lua had already used the 
output console with 100.000 lines of output, there is no speed problem. 
But on the first run it took 17,5 seconds for memory allocation, on the 
second run it took only 0.178 seconds (Windows 10).

Jan

for i =1,100000,1 do
print(i)
end





More information about the JWLua mailing list