View Single Post
Old 06-28-2020, 11:26 AM   #3
Meo-Ada Mespotine
Human being with feelings
Meo-Ada Mespotine's Avatar
Join Date: Apr 2020
Location: Leipzig
Posts: 875

I would guess, that the sheer amount of new items created(10.000) means, that Reaper needs to shuffle around a lot of memory.
The more items, the slower Reaper becomes because of more memory shuffling.

This becomes obvious, if you comment out this line:
  reaper.Main_OnCommand(41309, 0)  --move item's duplicate
which keeps the script fast.

I would think, that it could be much faster to create the ItemStateChunks you want to have first, add them into the TrackStateChunks of the tracks, in which you want to have the duplicated items and then commit it only once via SetTrackStateChunk.
That way, Reaper would need to shuffle a lot of memory around only once and not 10.000 times.

But it's a wild guess...

The logging isn't the problem in here, as it only happens a few times and always a single line. The console just slows down, if you try to write dozens of lines into it at once for numerous times, which is no the case in dysrock's script.
Use you/she/her, when contacting me, please. Thanks :) Not mentoring via PMs, sorry.
Ultraschall-API - 1200 ReaScript functions for Reaper - Reaper Internals - Developerdocs4Reaper - Donate, if you wish
Meo-Ada Mespotine is offline   Reply With Quote