3 ms·
Now that I've finished reading, I'm curious why the Chrome team didn't optimize GetLinkedFonts since it's the obvious culprit to my eye. Querying the registry i
by vlovich123 6y ago
Now that I've finished reading, I'm curious why the Chrome team didn't optimize GetLinkedFonts since it's the obvious culprit to my eye. Querying the registry is slow. Really slow. . The Chrome code appears to always read it on a missing value. If you have a missing value in your already populated cache, then every miss is going to reach out to the infrequently changing registry. It makes far more sense to only invalidate your in-process cache when the registry actually changes
- londons_explore 6y agoIndeed it would seem a trivial change to cache failed lookups here[1] [1]: https://source.chromium.org/chromium/chromium/src/+/master:ui/gfx/font_fallback_win.cc;l=151;drc=3b4736cba1d80c07fe3633694f250d20e9d9a64d;bpv=1;bpt=1?q=GetLinkedFonts https://source.chromium.org/chromium/chromium/src/+/master:u...
- vlovich123 6y agoYup. Looked at the source first to double-check there wasn't a legitimate reason for the registry read. EDIT: Filed the suggestion upstream: https://bugs.chromium.org/p/chromium/issues/detail?id=1202146 https://bugs.chromium.org/p/chromium/issues/detail?id=120214...
- masklinn 6y ago> Now that I've finished reading, I'm curious why the Chrome team didn't optimize GetLinkedFonts since it's the obvious culprit to my eye. That's the point of the article: `GetLinkedFonts` is the "obvious culprit", but it's the fallback to the fallback, it should not be getting called in the first place. It doesn't really matter that it's slow because it should almost never be called. And then, I assume they fixed (or will fix) the cache so that it'd cache failures, so GetLinkedFonts would only be called once per failure instead of being called over and over again, only for failure (as successes would get cached after the first one).
- vlovich123 6y agoAs you can see from another comment, they’re being in efficient in the “uncommon” case and reading the registry even when there’s no changes. How often is “not often”? The 1% case they’re trying to tackle. It’s ~1-2 weeks (maybe more) for one engineer to watch the registry and either they didn’t think of that or consider it not yet warranted for ROI (or didn’t think to do a registry watcher).