Long loading times due to variable declaration
-
Hello everyone! :-)
I have a fairly extensive project with a lot of parameters and associated UI elements. I actually need dedicated sliders for most parameters in order to be able to use HISE's modulation capabilities. A slider with a callback that works depending on the situation is therefore not possible.
My problem is that the project has very long loading times. In HISE, it takes about 23 seconds after I press “Compile.” And even the compiled plug-in takes a long time to load.
I have discovered that this is due to my variable declarations. I have about 1000 lines of code that look something like this:
const bigLeftKnobs = Content.getAllComponents(“^(?=.*lknb)(?!.*sknb).*$”);In another section of the code, I then assign callbacks and look-and-feels as follows:
for(k in bigLeftKnobs) { k.setControlCallback(callbackFunction); k.setLocalLookAndFeel(lafFunction); }However, with
const all = Content.getAllComponents(“”)I also get all UI elements, but this is extremely fast. My idea is therefore to get all UI elements this way and then assign them as follows:
for(e in all) { if(e.getId().contains(“lknb”) && !e.getId().contains(“sknb”)) { k.setControlCallback(callbackFunction); k.setLocalLookAndFeel(lafFunction); } {What do you think? That should speed up the loading process, right? I thought I'd ask around here, as it would probably take a few days to modify my code accordingly, and maybe one of you has an even better idea. :-)
Thanks and all the best,
Oli -
@Oli-Ullmann said in Long loading times due to variable declaration:
That should speed up the loading process, right?
Yes, just having a single reference to each component instead of multiple is going to be better.
-
@David-Healey
Okay, refactoring time. :-)
How do you solve this problem in large projects? In a similar way? -
@Oli-Ullmann said in Long loading times due to variable declaration:
How do you solve this problem in large projects? In a similar way?
I use individual declarations most of the time, unless I have a group of controls that are related. I also use broadcasters when I can and assignments in the property editor instead of callbacks.
-
@David-Healey
All right, thank you for your input! :-) -
O Oli Ullmann has marked this topic as solved