Pooling of undo steps is slow

The performance of collecting undo steps seems to be very, very slow currently. I’ve tried to pool steps in the AHX Importer. It makes a lot of API calls for sure, but even when I tried to pool the steps per created instrument, after the import, Renoise has a 10-second freeze, where it obviously gets its undo history right. In the end, I removed any pooling of undo here, since no matter what I’ve tried, it resulted in a huge unresponsive lag.

Do you mean describe_batch_undo ?

Good morning, yes exactly.

In an early version, the AHXImporter called rns:describe_batch_undo(description, 10000) in each of the ProcessSlicer calls, so it still could print about what is happening. Renoise collected an undo step for each ProcessSlicer fragment. After the whole process was finished, then Renoise merged the undo steps together, which is causing that 5-10 seconds unresponsiveness. That’s at least my theory about what’s happening :sweat_smile:

Here is another approach in which the ProcessSlicer is only called in between each instrument and also the undos are joined together per instrument. A shorter lag then happens after each instrument creation, and there is no detailed output possible anymore about what’s going on. The import is much faster here, too, but might run into script timeout on slow machines:
Another failed approach for joining undo steps

In the end, there seems to be no good way to use rns:describe_batch_undo() in this tool.

Surely you have put a lot of thought into this problem already, but could this clearing-up of the undo buffer be improved in speed?

Here is a test tune, in case you want to experiment here:

syphus - returns.ahx.xrns (Remove .xrns)

How would you use rns:describe_batch_undo() in AHXImporter?