Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 06-22-2017, 05:28 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,251
Default MIDI editor: Recent versions get unnecessarily bogged down if multiple takes visible

REAPER is renowned for its highly efficient and optimized audio engine. I hope that the same skills will be applied to the MIDI editor.

REAPER gets *unnecessarily* bogged down when multiple takes are visible or editable in the MIDI editor, and it seems to be getting worse and worse in recent versions.

I compared the speeds of versions 5.00 to 5.40, using the following simple script:
Code:
local take = reaper.MIDIEditor_GetTake(reaper.MIDIEditor_GetActive())
local prevTime, currentTime = 0, reaper.time_precise()
local n = 0 -- Count number of cycles
tCycleTimes = {} -- Table to store the time taken for each cycle

local maxCycles = 10

function testDeferSpeed()
    prevTime = currentTime
    currentTime = reaper.time_precise()
    n = n + 1
    tCycleTimes[n] = currentTime - prevTime
    reaper.MIDI_InsertCC(take, true, false, n, 0xB0, 0, 1, 100)
    if n >= maxCycles then
        return 
    else
        reaper.defer(testDeferSpeed)
    end
end

reaper.defer(testDeferSpeed)
The script makes a small MIDI edit to the active take in each defer cycle, and then measures the time between each defer cycle.

Results:

If I only have the active track visible/editable in the MIDI editor, and I run the test script, each defer cycle only takes a few hundredths of a second, as expected.

However, if I make several large takes visible in a single MIDI editor (for example, 15min orchestral tracks with lots of CCs), each defer cycle takes almost 1.5 seconds!

Strangely, this even happens when none of these large takes have any visible MIDI in either the editor or the arrange view. For example, if these takes only start at measure 10, and both the MIDI editor and the arrange view are zoomed in to measures 1-5 (i.e. only the active take overlaps the zoom areas), the defer cycles are still as slow!

The MIDI editor should be optimized so that
* Takes that haven't been changed, should not be re-analyzed, and only mimimal re-drawing of the MIDI data should performed, if any MIDI data is visible in the editor.
* Takes that have no MIDI data visible in the MIDI editor, should not have any effect on the MIDI editor's responsiveness.

And it gets even stranger... Older versions of REAPER are much, much faster: When I tested the same project in versions 5.00 to 5.40, I got the following average times:
v5.00: 0.42s per defer cycle
v5.10: 0.44s
v5.20: 0.61s
v5.30: 0.98s
v5.40: 1.43s

v5.40 is more than three times slower than v5.00!

Last edited by juliansader; 07-23-2017 at 03:44 AM.
juliansader is offline   Reply With Quote
Old 06-22-2017, 04:07 PM   #2
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,251
Default

The deeper I investigate, the more worrisome results I get:

Having multiple takes per item bogs down the MIDI editor even worse -- even though only one take per item can be seen or edited in the editor. Having two takes in each item that is visible in the MIDI editor *doubles* the defer cycle time, and having three takes *triples* the cycle time.

Since the non-active takes in multi-take items are not available for editing in the editor, and their MIDI data is not displayed, the number of takes per item should have negligible effect on the responsiveness of the MIDI editor.
juliansader is offline   Reply With Quote
Old 11-08-2017, 07:23 PM   #3
_Stevie_
Human being with feelings
 
Join Date: Oct 2017
Posts: 104
Default

Is that the reason, why you use MIDI_SetAllEvts instead of MIDI_InsertCC?
_Stevie_ is offline   Reply With Quote
Old 11-09-2017, 11:14 AM   #4
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,251
Default

Quote:
Originally Posted by _Stevie_ View Post
Is that the reason, why you use MIDI_SetAllEvts instead of MIDI_InsertCC?
Alas, this problem seems to affect all deferred MIDI scripts, even if they use MIDI_SetAllEvts.
juliansader is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.