Hi everyone !
Since my first journey on OSC I accumulated thousands of widgets in my template which caused two annoying issues as I went deeper into it:
-
When loading the session I keep having the notification:
"The connection to the server has been interrupted" which can't be removed but the session is working. -
I'm noticing a slow performance when clicking on buttons.
As suggested by @jean-emmanuel here: Connection issue/Heavy session - #9 by Sub3OneDay
I already removed all Base64 images I had which helped in the optimization.
Lesson learnt from that: Avoid using Base64 images if it's possible.
Now I created a new topic as I would like to have your thoughts on:
How to avoid widgets duplication to optimize OSC on a specific case.
As you can see below, I have the following example:
- A panel containing 4 tabs
- Inside tab_1 you have a button which represents the 1rst beat of the 1rst bar in 4/4,
(inside tab_2 another button with the same layout but now its the 1rst beat of 2nd bar in 4/4, etc...)
Those 4 tabs can be switched with the switch under the panel.
Everything works well and it looks sweet, but if we imagine what comes later we will easily pile up hundreds of tabs which would end up hurting OSC.
If we do the math, we now have 6 different widgets:
- 1 panel
- 4 buttons
- 1 switch
Now an initial idea I had was to optimize it by only using 1 button and 1 switch as follow:
So in the end, the goal would be to keep the button's layout but changing its behaviour by using a switch. That way I would avoid duplicating the same button 4 times again.
Also avoiding clones or the widget's visibility property will be needed as from what I could experience the more we add new widgets, the more OSC can slow down.
MAIN QUESTION:
Could you please let me know how to go around that workflow ?
Or if you have a better way to set up that ? I would love to hear from anyone of you.
Also I'm curious about something, probably question to @jean-emmanuel but anyone else is welcome:
Does it take more resources to use let's say 100 buttons compared to 1 single switch containing 100 computed values ? Or it doesn't make any difference at all ?
Looking forward to read you,
Swayrian