Custom workspace = slow HISE
-
@Christoph-Hart I've narrowed it down. When I remove the API browser from my custom workspace everything works normally.
-
I'm digging up this thread again. I posted another thread recently where I mentioned HISE was laggy and I thought it might be down to Alder Lakes E/P cores. But I disabled all the P cores and it didn't make a difference.
So then I started wondering if it was the issue in this thread and it was caused by the API browser now being present in the sidebar. So I commented out the source code where that API browser is added, and bullseye, HISE opens instantly. It also closes instantly now too, I never noticed that was lagging also.
So @Christoph-Hart when you have a moment, please see if you can find out why the presence of the API browser causes HISE be super laggy on Linux.
-
I've looked into this further and the issue is related to the help text generation. If I comment out this line, HISE loads up quickly (but obviously I get no help text).
Could this data be cached so it doesn't have to recreated everytime HISE is opened?
-
@Christoph-Hart Got any ideas about this?
-
@d-healey Hmm, this is already "cached" in the sense that it just parses a compressed value tree containing the docs and creates a C++ object containing the formatting which shouldn't take too long.
Can you investigate further? Maybe it's time for you to learn how to use a profiler to find hotspots - this should give you an exact call stack of the heaviest calls including where it spends the most time so we can pinpoint it down to the font hinting algorithm (my guess here). I think the main one in Linux is valgrind but I've never used it and I can imagine there is some Linux-style extra nerd layer applied to its workflow :)
EDIT: This looks like the tools I'm using on Windows / macOS and allows you to attach the profiler to a running HISE build, so it might be easier to get running.
-
@Christoph-Hart Thanks, I'll take a look and report back
-
Not exactly sure what I'm looking for but this stuff is eating some CPU when the API thingy isn't commented out.
-
@d-healey yup, looks font related (libfreetype seems to be the font library on Linux). Can you check the call stack for this call?
-
-
This post is deleted! -
Ah I think I finally worked out how to see some useful data. Does this help?
Digging further. It seems to be all these
help.
commands inCodeEditorApiBase.cpp
-
@d-healey it looks like it‘s not caching the fonts so it destroys them everytime…
-
@Christoph-Hart Could this be related? https://forum.juce.com/t/slow-startup-due-to-font-enumeration/6864
-
@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.
-
@Christoph-Hart Thanks. I'll give it a try now
-
@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.
-
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:~Instance() { int x = 5; }
-
@Christoph-Hart I'll give it a go after lunch and report back.
-
The destructor is triggered every time
GLOBAL_BOLD_FONT()
is called. -
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.