slow lua song pattern

Hi,

I generate with LUA script a whole song with a length of, near, 3 minutes. So I create several patterns with more than one track (four sometimes). So there is a lot of notes to define in each track. I am surprised by the slowness… Firstly, I was doing this music generation with Javascript and abc format file (not for renoise) but it was not too slow…

It is obviously perhaps my code (I am new to LUA) but I wonder me if there is something to know before doing a whole song by script. I have seen there is a bug with auto sort sequence (slowness when you suppress a note in pattern) and I wonder me if I have to de-activate something in script (or in the property renoise) to improve the generation speed.

Perhaps there are some observable/observer linked to the fact to modify something in the pattern for instance…

Thanks

Perhaps you could share a bit of your code, otherwise people are simply left guessing?
But in general, when you are manipulating pattern data in Renoise, it is important to select the right type of iterator:
you have different iterators for tracks, patterns and the whole song. Choosing the right iterator will definitely affect overall speed.

Also, you might consider creating a tool which will process the data in “slices” - this will ensure that you never get those annoying
“a script is taking very long time to complete” popup messages.
It’s not trivial to convert your tool into using a sliced process, but check out this example tool to view the concept in action.