Runtime Complexity: Degraded Performance

Odd observation about runtime complexity with my latest XRNX: http://tinyurl.com/X…Shortcuts-Beta1 The tool’s function “Menu => More Shortcuts => Refresh Cache…” takes about 60 seconds to complete on my PC with the following result:

448 new shortcuts available: 382 DSP effects, 18 audio plugins, 39 metronome, 1 tempo tap, 4 view switch, 4 transport.  
  

The tool’s function updates the key bindings using the following LUA helper function:

  
 function Util:addKeyBinding(name, fun)  
 local tool = renoise.tool()  
 if (tool:has_keybinding(name)) then  
 tool:remove_keybinding(name)  
 end  
 tool:add_keybinding { name = name, invoke = fun }  
 end  
  

But when there are lots of keybindings defined, the runtime of the functions:

* tool:has_keybinding(name),  
* tool:remove_keybinding(name),  
* tool:add_keybinding{ name = name, invoke = fun }  

degrades. Runtime complexity of these functions seems to be O(n) not O(1) unfortunately. The same observation seems to hold true for the functions:

 * tool:has_menu_entry(name)  
 * tool:remove_menu_entry(name)  
 * tool:add_menu_entry{ name = name, invoke = fun }  

and:

 * tool:has_midi_mapping(name),  
 * tool:remove_midi_mapping(name),  
 * tool:add_midi_mapping{ name = name, invoke = fun }  

But I’m not quite shure, what degrades the performance here. It might be the number of bindings already defined. Any help is kindly appreciated.

One enhancement could be to allow for the ```
add_*()

  
[b]Update[/b]: please move this post to the bugs/enhancements forum.

Thanks for the detailed report. Will be a lot faster in the next Renoise update.