Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up~20 seconds startup time on Android because CSS Layout & libfontconfig #16195
Comments
|
This sounds like the same issue described in #12931, and #12931 (comment) described a particular reason why the cache wasn't working. |
bors-servo
added a commit
that referenced
this issue
Jun 6, 2017
Ged rid of libfontconfig in Android Libfontconfig dependency is causing huge startup times in Android (20 seconds on each page load!). On other platforms fontconfig caches are already available or can be prebuilt on installation scripts, but this can't be done on Android. Updating libfontconfig dependency doesn't fix the problem either. This PR gets rid of libfontconfig in Android. It queries available fonts and variations from Android System font configuration files. Android doesn't provide an API to query system fonts until Android O (which is very far from the minimum API right now...) --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #16195 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17141) <!-- Reviewable:end -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I found that Servo on Android takes a lot of time to show anything on screen in most pages because CSS layout operations wait for libfontconfig initialization, which takes about 20 seconds (tested on Google Pixel). The problem seems to be that libfontconfig tries to read all system fonts on the FcInit method, and that takes a lot of time. This is done on every startup, the cache doesn't seem to work. Even if we can fix the cache, 20 seconds is a huge time for the first startup and it could ruin the initial impression for users when running servo. I also experienced some startup problems in the past on Windows, it might be related to this problem too.
On other platforms fontconfig caches can be prebuilt on the installation scripts, but this can't be done on Android with plain apks.
Some ideas to fix the issue:
servo/components/gfx/font_cache_thread.rs
Line 137 in c025a79
What do you think?