Performance tips?

It seems that lua is running in the main thread / gui thread of renoise. So when you do heavy lua stuff, the gui will freeze. Is there a special trick, so that slow lua functions wouldn’t hurt the renoise performance?

Danoise gives some excellent advice in this thread: https://forum.renoise.com/t/renoise-tools-speed-optimization-initiative/45510

If you have a specific example of something heavy, I’m quite sure you could get some help on the forum by posting an example.

PS. Being on an i7 processor, I’ve only really noticed heavy load during one specific circumstance - when heavily swapping the positions of large instruments. I’m curious if even this could somehow be “masked” with idle notifier and possibly coroutines.

I made an callback for selected_instrument to refresh the button led’s on the midi fighter on instrument change, where i need to send note off midi events to deactivate the old ones and send note on midi events to enable the new ones. But this was causing a one second lag in the whole renoise gui, every time, when an instrument was selected. Is there a way to make these calls on a separate thread, so it wont hurt the gui / main loop of renoise?