New issue
Advanced search Search tips

Issue 902782 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 8
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Chrome , Mac
Pri: 3
Type: Feature

Blocking:
issue 903973



Sign in to add a comment

Enable harfbuzz compiler optimizations

Project Member Reported by cavalcantii@chromium.org, Nov 7

Issue description

Experiments with hb-shape show that enabling compiler optimizations improves performance of text shaping (therefore should help layout).

Initial tests show an improvement of 10.4% in hindi-line-layout and 12.1% in latin-ebook performance layout tests.
 
Components: Blink>Fonts
Status: Assigned (was: Untriaged)
Results in a Nexus 5x:
https://pinpoint-dot-chromeperf.appspot.com/job/14b944a3e40000
hb_comp.png
238 KB View Download
Wikipedia page layout time in a Google Pixel shows around 6% performance gain in the time spent doing layout.

hb_comp_wikipedia.png
379 KB View Download
Impressive!
Even though the installed size of the library will be smaller:
adenilson@chrome-monster:~/chromium/src/out/optimized$ ls -lha ./libfreetype_harfbuzz.cr.so
-rwxr-xr-x 1 adenilson adenilson 853K Nov  6 12:08 ./libfreetype_harfbuzz.cr.so
adenilson@chrome-monster:~/chromium/src/out/optimized$ ls -lha ./libfreetype_harfbuzz.cr.so
-rwxr-xr-x 1 adenilson adenilson 740K Nov  6 14:41 ./libfreetype_harfbuzz.cr.so

The entropy level of the binary libs is higher (i.e. more complex symbols added by the compiler), see the chart.

Confirmed the theory that due to higher entropy, the compressed apk will be bigger (i.e. apks are gzipped compressed).
 
adenilson@chrome-monster:~/chromium/src/out/optimized$ ls -lh opt_libfreetype_harfbuzz.cr.so.gz vanilla_libfreetype_harfbuzz.cr.so.gz -rwxr-xr-x 1 adenilson adenilson 433K Nov  7 14:38 opt_libfreetype_harfbuzz.cr.so.gz
-rwxr-xr-x 1 adenilson adenilson 421K Nov  7 14:37 vanilla_libfreetype_harfbuzz.cr.so.gz

hb_comp_entropy_lib.png
25.9 KB View Download
Therefore, the 12KB to 14KB size increase in the library is within the expected.

Project Member

Comment 7 by bugdroid1@chromium.org, Nov 8

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7dca8e135107aaadf73f83e2bd49feac120bd2c5

commit 7dca8e135107aaadf73f83e2bd49feac120bd2c5
Author: Adenilson Cavalcanti <adenilson.cavalcanti@arm.com>
Date: Thu Nov 08 00:20:00 2018

Enable compiler optimizations on Harfbuzz

Experiments with hb-shape show that enabling compiler optimizations
improves performance of text shaping (therefore should help layout).

Initial tests show an improvement of 10.4% in hindi-line-layout
and 12.1% in latin-ebook performance layout tests.

Binary-Size: compiler optimized library will increase the size of the apk.
Bug:  902782 
Change-Id: Iee50a04403ec634efec17be5ef8a72b996711a2f
Reviewed-on: https://chromium-review.googlesource.com/c/1321250
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
Reviewed-by: Emil A Eklund <eae@chromium.org>
Reviewed-by: Behdad Esfahbod <behdad@chromium.org>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606240}
[modify] https://crrev.com/7dca8e135107aaadf73f83e2bd49feac120bd2c5/third_party/harfbuzz-ng/BUILD.gn

In a rock64 ARM board (with low cost/power efficient little quad-cores A53), the performance boost for loading the C++ wikipedia page was 11%.
hb_comp_wikipedia_rock64.png
354 KB View Download
Status: Fixed (was: Assigned)
Thank you for working on this!

Blocking: 903973

Sign in to add a comment