-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look into improving Arcade's startup time #1159
Comments
Do we need to preload these default fonts? The examples seem to be the main place they're used. Lines 571 to 583 in c5ac350
Defaults in the API seem to use Arial or calibri: arcade/arcade/gui/widgets/text.py Line 64 in bf28ded
Line 176 in 2a7c1f1
Line 638 in 2a7c1f1
Line 553 in 2a7c1f1
Once I'm done with some current projects, I can look at replacing this preload list with a libre font that's metrically compatible with Arial as part of #1135. |
I would love a patch to remove this default font loading. It is both slow, surprising (I'm not using any text in my application, but pay the font loading cost), and incidentally causes issues with Bazel build integration because Bazel does not support any files with whitespace (so it ignore them from the wheel): bazelbuild/rules_python#617 |
So that means there are two issues:
|
@ClintLiddick Quick fix for whitespace in files names now in development at least : f012e7b We can probably find some way to disable the font loading. The issue is not the font loading itself. That's pretty fast. The real issue is that pyglet will scan all system fonts when you access the Still. It's definitely annoying when you don't use text. |
Recap of what I was told in the pyglet Discord today:
That's an upstream change as I understand it, but one that seems like it should be simple if I can figure out where the font loading actually gets invoked. |
We did some testing the other day. The font scanning is gone on windows since we no longer use GDI.
Startup times will rely on OS. I haven't tested for linux and mac. This is the worst case situation for me after profiling over a few days
|
Clarification, Windows 7 does use DirectWrite as well in Pyglet, it just doesn't have all the features that 8.1+ does (colored font characters/emojis for example). Right now when you use a tuple of font names, a call of That being said I did investigate a bit, and there is a way to check if a font exists for GDI+ without enumerating all of the fonts. With that fix in, it took |
@caffeinepills We don't really worry about 2.6 at this points, but I'm sure that's a great addition for other pyglet users if people are using GID. I'm not sure how widespread that is. Looking into media and input initialization will probably benefit more people? I don't know if there's any improvements that can be done here. In arcade we should start by not importing sound/media/input on arcade import by default. |
Can say how you did the profiling? I can test on Linux |
You might want different sorting: https://docs.python.org/3/library/profile.html#instant-user-s-manual
Startup time will vary due os caching and devices going to sleep. |
Font loading in |
Arcade can be pretty slow at startup. Especially the first time you launch it. The OS will do some caching causing future startups faster. Investigate what is taking up all this time. We know font loading is one of the reasons.
The text was updated successfully, but these errors were encountered: