HISE Logo Forum
    • Categories
    • Register
    • Login

    Custom workspace = slow HISE

    Scheduled Pinned Locked Moved General Questions
    51 Posts 3 Posters 2.9k 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 @Christoph Hart
      last edited by

      @Christoph-Hart Could this be related? https://forum.juce.com/t/slow-startup-due-to-font-enumeration/6864

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @d.healey
        last edited by

        @d-healey I've pushed a possible fix that might keep the fonts alive on Linux and avoid the reconstruction of the font every time it's used), but I can't test it and it might be possible that this doesn't affect anything, so please check if it helps.

        d.healeyD 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @Christoph Hart
          last edited by

          @Christoph-Hart Thanks. I'll give it a try now

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey
            last edited by

            @Christoph-Hart Doesn't appear to have helped unfortunately. Just to confirm that it isn't something unique to my system I also tested in a virtual machine and it's the same.

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @d.healey
              last edited by

              Can you add the destructor to the LinuxFontHandler::Instance() class, then set a breakpoint in its body (at the bogus line) and check when it's called? It should stay alive during the entire lifetime of the HISE application:

              Link Preview Image
              HISE/hi_tools/Macros.h at 65fbb2e8cdbb2e365bfbb38186be259b8735f2c9 · christophhart/HISE

              The open source framework for sample based instruments - HISE/hi_tools/Macros.h at 65fbb2e8cdbb2e365bfbb38186be259b8735f2c9 · christophhart/HISE

              favicon

              GitHub (github.com)

                  ~Instance()
                  {
                      int x = 5;
                  }
              
              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @Christoph Hart
                last edited by

                @Christoph-Hart I'll give it a go after lunch and report back.

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by

                  The destructor is triggered every time GLOBAL_BOLD_FONT() is called.

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey
                    last edited by d.healey

                    I tried replacing the defines with this, to cut out the extra class stuff:

                    #define GLOBAL_FONT() (Font(Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::oxygen_bold_ttf, HiBinaryData::FrontendBinaryData::oxygen_bold_ttfSize)).withHeight(13.0f))
                    #define GLOBAL_BOLD_FONT() (Font(Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::oxygen_regular_ttf, HiBinaryData::FrontendBinaryData::oxygen_regular_ttfSize)).withHeight(14.0f))
                    #define GLOBAL_MONOSPACE_FONT() (Font(Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::SourceCodeProRegular_otf, HiBinaryData::FrontendBinaryData::SourceCodeProRegular_otfSize)).withHeight(14.0f))
                    #define GLOBAL_BOLD_MONOSPACE_FONT() (Font(Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::SourceCodeProBold_otf, HiBinaryData::FrontendBinaryData::SourceCodeProBold_otfSize)).withHeight(14.0f))
                    

                    And surprisingly it made a big improvement. I don't think it's as fast as on Windows/MacOS though. And all the fonts in the GUI have changed, so I probably broke something :p

                    Scriptnode also isn't lagging like crazy now, so I think that issue was related.

                    And HISE isn't crashing as much when switching between big projects! How I have waited for this day.

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    1 Reply Last reply Reply Quote 3
                    • d.healeyD
                      d.healey
                      last edited by

                      @Christoph-Hart Any more suggestions for me to try?

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @d.healey
                        last edited by

                        @d-healey try again with the latest build...

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @Christoph Hart
                          last edited by

                          @Christoph-Hart No improvement unfortunately. But wouldn't you have to make some change in Macros.h too since the GLOBAL_FONT defines are still calling LinuxFontHandler::Instance()...?

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          Christoph HartC 1 Reply Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart @d.healey
                            last edited by

                            @d-healey Yeah my hope was that if you construct one instance that is alive during the entire lifetime of the app that it will keep alive the shared data object that holds the fonts. See here:

                            Link Preview Image
                            JUCE: SharedResourcePointer< SharedObjectType > Class Template Reference

                            favicon

                            (docs.juce.com)

                            So the solution is definitely keeping this thing alive. On the other hand it's so long time ago that I've implemented the custom Linux solution that I forgot why it's there in the first place (a comment would be nice here). So maybe we have to think about an entirely different approach and the performance impact that it has on Linux should definitely be addressed. Maybe I need to dust off my linux distro and give it a shot as this requires some advanced debugging.

                            d.healeyD 1 Reply Last reply Reply Quote 3
                            • d.healeyD
                              d.healey @Christoph Hart
                              last edited by

                              @Christoph-Hart You should join us in Proxmox land where every OS is at your fingertips.

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              1 Reply Last reply Reply Quote 1
                              • d.healeyD
                                d.healey
                                last edited by d.healey

                                @Christoph-Hart Is this Linux font handler stuff needed?

                                I just replaced the calls with this and it's now as fast as on Windows and MacOS

                                static Typeface::Ptr oxygenBoldTypeFace = Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::LatoBold_ttf, HiBinaryData::FrontendBinaryData::LatoBold_ttfSize);
                                static Typeface::Ptr oxygenTypeFace = Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::LatoRegular_ttf, HiBinaryData::FrontendBinaryData::LatoRegular_ttfSize);
                                static Typeface::Ptr sourceCodeProTypeFace = Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::SourceCodeProRegular_otf, HiBinaryData::FrontendBinaryData::SourceCodeProRegular_otfSize);
                                static Typeface::Ptr sourceCodeProBoldTypeFace = Typeface::createSystemTypefaceFor(HiBinaryData::FrontendBinaryData::SourceCodeProBold_otf, HiBinaryData::FrontendBinaryData::SourceCodeProBold_otfSize);
                                
                                #define GLOBAL_FONT() (Font(oxygenTypeFace).withHeight(13.0f))
                                #define GLOBAL_BOLD_FONT() (Font(oxygenBoldTypeFace).withHeight(14.0f))
                                #define GLOBAL_MONOSPACE_FONT() (Font(sourceCodeProTypeFace).withHeight(14.0f))
                                #define GLOBAL_BOLD_MONOSPACE_FONT() (Font(sourceCodeProBoldTypeFace).withHeight(14.0f))
                                

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

                                1 Reply Last reply Reply Quote 1
                                • d.healeyD
                                  d.healey
                                  last edited by

                                  @Christoph-Hart I definitely think whatever I did in my last post fixed the problem. It's super fast on Linux now, I tested on my current system and a few year old Linux Mint release. I also tested a compiled project, no issues.

                                  Any reason I shouldn't make a pull request?

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  Christoph HartC 1 Reply Last reply Reply Quote 0
                                  • Christoph HartC
                                    Christoph Hart @d.healey
                                    last edited by

                                    @d-healey Yes, go for it, I forgot what that LinuxFontHandler stuff was about anyways...

                                    Christoph HartC 1 Reply Last reply Reply Quote 1
                                    • Christoph HartC
                                      Christoph Hart @Christoph Hart
                                      last edited by

                                      @Christoph-Hart A quick search in the JUCE forum yielded this:

                                      https://forum.juce.com/t/lookandfeel-custom-fonts-linux-leaks/53914

                                      Apparently using static instances causes the memory leak detector to fire on Linux (probably why I was introducing the LinuxFontHandler stuff).

                                      d.healeyD 1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @Christoph Hart
                                        last edited by

                                        @Christoph-Hart How can I detect if a leak is happening?

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        1 Reply Last reply Reply Quote 0
                                        • d.healeyD
                                          d.healey
                                          last edited by

                                          @Christoph-Hart Two interesting things I noticed with my "fix". Debug builds of HISE give a segfault, and my compiled plugin crashes pluginval. I guess this is related to the leak problem.

                                          However it's much more pleasant to work in HISE when I don't have this slow issue so I'm thinking a pre-processor definition is the way to go until a proper fix is possible.

                                          Libre Wave - Freedom respecting instruments and effects
                                          My Patreon - HISE tutorials
                                          YouTube Channel - Public HISE tutorials

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

                                          50

                                          Online

                                          1.7k

                                          Users

                                          11.7k

                                          Topics

                                          102.1k

                                          Posts