HISE Logo Forum
    • Categories
    • Register
    • Login

    [bug] SlotFX.setBypassed no worky

    Scheduled Pinned Locked Moved Bug Reports
    21 Posts 3 Posters 207 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey @Orvillain
      last edited by d.healey

      @Orvillain said in [bug] SlotFX.setBypassed no worky:

      What is the benefit of using const, in my situation?

      I think the best answer is from Christoph

      it yields a huge performance boost (because it can resolve the function call on compile time).
      There is absolutely no reason to not declare UI widgets, references to modules (via Synth.getModulator() etc.) not as const

      reg is good for accessing script level variables in midi callbacks and anywhere else where you would have had to use a script level var. But the more reg you have (and you only get 32 per namespace) the worse the performance gets. Internally reg is like a predefined array that HISE is keeping track of. So the more values you add the more data it needs to go through each time to you access it.

      Another addition to Javascript: Use reg instead of var when declaring temporary variables which are accessed in the MIDI (or audio) callbacks. It tells the interpreter to store this in a fixed size container with faster access times:
      If you have a script with lots of variables, the interpreter must search the entire array for every variable access (so the 23 - 40 ms are depending on how many other variables are defined in the script while the access time to reg slots stay the same).

      It's also possible since you're storing them in an object rather than as direct references that const gives no performance benefit. But it's still good practice to use a const here. It makes it clear to other developers who might see your code (or your future self) that this variable is not meant to be reassigned, and it also prevents it being reassigned accidentality.

      Free HISE Bootcamp Full Course for beginners.
      YouTube Channel - Public HISE tutorials
      My Patreon - HISE tutorials

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      70

      Online

      2.0k

      Users

      12.9k

      Topics

      111.9k

      Posts