Open Bug 1580656 Opened 6 years ago Updated 2 years ago

Do not scan for new fonts so aggressively on Linux

Categories

(Core :: Graphics: Text, defect, P3)

Desktop
Linux
defect

Tracking

()

Performance Impact low
Tracking Status
firefox71 --- affected

People

(Reporter: Gijs, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: main-thread-io, perf, perf:resource-use)

It seems by default, the refresh interval specified in fontconfigs on linux distros is 30s.

This means we scan every 31 ( https://searchfox.org/mozilla-central/rev/a777ff11b6d700a698c61e5bd17e73b044304494/gfx/thebes/gfxFcPlatformFontList.cpp#1412 ) seconds.

Doing this scan hits hundreds of files on my machine, from the main thread. Sure, hopefully they're in the filesystem cache, but also, this is gonna evict stuff from the cache that maybe I actually want.

I'm probably atypical, but I do not recall installing any fonts, ever, since initially setting up my machines. It seems bad to effectively interrupt our mainthread ~twice a minute (even when in the background, even when the machine is unattended, ...) on the off-chance that the user has installed additional fonts. Surely there is a better way to do this? If not, can we at least not do it on the main thread, or change the interval to be like... 10 minutes or something?

Blocks: 1580658

Do we really need to rescan the fonts while running? It got fixed at some point, but IIRC Firefox used to hang for some 30 seconds or so shortly after updating my system's fontconfig while it was running. There are plenty of preferences that need a restart to be applied, and I'd prefer if Firefox didn't unnecessarily do stuff in the background.

Ah, never mind, I just realized that fontconfig does the scanning anyway, and Firefox only requests the new one.

gfxFcPlatformFontList::CheckFontUpdates still seems a bit iffy to me -- is it guaranteed that FC will return a different pointer if the configuration changed? Maybe, since it probably needs to store both the old and new one at once, but I don't know how that works (who the old config?).

See also bug 1162369.

See Also: → 1162369
Whiteboard: [qf] → [qf:p3:resource]
Priority: -- → P3
Performance Impact: --- → P3
Whiteboard: [qf:p3:resource]
Severity: normal → S3
See Also: → 1819364
You need to log in before you can comment on or make changes to this bug.