performance critical libyuv built with Os

Bug #1694425 reported by Julian Taylor
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
firefox (Debian)
Fix Released
Unknown
firefox (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Imported from Debian bug http://bugs.debian.org/863672:

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--aN5BOcfPQ1wkI3kOWF0Bpe7cmio8VfIEp
Content-Type: multipart/mixed; boundary="SrbvOHijIbL538GHuOsAk6jhGEBxW5ENR";
 protected-headers="v1"
From: Julian Taylor <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Message-ID: <email address hidden>
Subject: performance critical libyuv built with Os

--SrbvOHijIbL538GHuOsAk6jhGEBxW5ENR
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: quoted-printable

Package: firefox
Version: 53.0.is.52.0.2-1
Severity: normal

libyuv which is a performance critical library for firefix is built with
-Os which is horrible for performance for it.
In particular row_common.cc which contains the generic parts of the
color transformation code:

See:
https://buildd.debian.org/status/fetch.php?pkg=3Dfirefox&arch=3Damd64&ver=
=3D53.0.is.52.0.2-1&stamp=3D1492644908&raw=3D0

/usr/bin/g++ -std=3Dgnu++11 -o row_common.o -c ... -fPIC
-DMOZILLA_CLIENT -include
/&lt;&lt;PKGBUILDDIR&gt;&gt;/build-browser/mozilla-config.h -MD -MP -MF
=2Edeps/row_common.o.pp -Wdate-time -D_FORTIFY_SOURCE=3D2 -Wall
-Wc++11-compat -Wempty-body -Wignored-qualifiers -Woverloaded-virtual
-Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code
-Wwrite-strings -Wno-invalid-offsetof -Wc++14-compat
-Wno-error=3Dmaybe-uninitialized -Wno-error=3Ddeprecated-declarations
-Wno-error=3Darray-bounds -fno-lifetime-dse -fstack-protector-strong
-Wformat -Werror=3Dformat-security -fno-schedule-insns2 -fno-lifetime-dse=

-fno-delete-null-pointer-checks -fno-exceptions -fno-strict-aliasing
-fno-rtti -ffunction-sections -fdata-sections -fno-exceptions
-fno-math-errno -pthread -pipe -g -freorder-blocks -Os
-fomit-frame-pointer
/&lt;&lt;PKGBUILDDIR&gt;&gt;/media/libyuv/source/row_common.cc

The problematic part is the YuvPixel function which is called in loops
and in turn calls tiny clamp functions.
Os disables inlining so this causes massive overhead.
This is the top cpu profile on sites which e.g. display videos.
  17.25% libxul.so [.] YuvPixel =E2=96=92
   6.58% libxul.so [.] Clamp =E2=96=92
   6.46% libxul.so [.] clamp255

The problem is not as bad as it looks as this generic code is only
executed on machines that do not have SSSE3, AVX2 or NEON (see
convert_argb.cc)
But there are still plenty useful cpus that do not have these
instruction sets and are crippled by the compiler flags used.

Is it possible to compile this library with O3 to allow the compiler to
vectorize it with the best available generic instruction set (e.g. SSE2
on x64).

cheers,
Julian Taylor

--SrbvOHijIbL538GHuOsAk6jhGEBxW5ENR--

--aN5BOcfPQ1wkI3kOWF0Bpe7cmio8VfIEp
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQI7BAEBCAAlBQJZLI9HHhxqdGF5bG9yLmRlYmlhbkBnb29nbGVtYWlsLmNvbQAK
CRAyzEqsAodW/yfHD/0ZBE3JGMGPM/yD3HNR4EslXMGKHxoT6JowG5TWI9UHy+5U
utj6vgrZ3hDEefGbI+UCDPehDK8tAlSTCI/wFxuqOO4+AB7EQia4bA2Agt7f3xfV
Y458uBPG860j7AEhgAtLHGN5TAZUwN5jegXj12qBtR1wCrk5gBCRDC6+wy+cqiE6
tApXdeM+3XsdYBS7udezJkw6NyhzMhiRebEwnB9wpztBIz/GSDxaftF0zLmrN4b8
CYNVPH426/YAbDkzzAphKJnlcLoELxeU42xVd2G34rPA8NoDbuw2J3ZV4oIGi+/v
S2XZsLkmcxFRb8JndfuayQtuGyMziPs4W2QDn3sZsh350hg77+V9/hYosxfnQc5d
Eetuu4rX4dGLdGFmq2fkrsB08G37Z6kl31B1TtvenZ2ejSGWoxc1gkHVmFfSDmCk
nfzuM5m+T518+7WZJ1HbEzI3ISQz1KtrKRPHLQi73N0qMRk6JZe4u3FVAOdxJYx9
QYqEKYaGLVMa3A3Nuwtn3QI4bXC3OoJSdHEl5wxDUV/zvruAsFhWYKl9QjqNo8Zn
2UWbr/hd3+2Lv/vVJLBr41AISi/6Ybs47FnloIqvEMlQDxlf1d4e2fLoqmal0oFv
QT3mIXWjBmf0f52tsYSRGNw4OiYPx/6iaMET9WhQm8K5lKSTgkjv04s9cad90A==
=P1R4
-----END PGP SIGNATURE-----

--aN5BOcfPQ1wkI3kOWF0Bpe7cmio8VfIEp--

Changed in firefox (Debian):
importance: Undecided → Unknown
Changed in firefox (Debian):
status: New → Confirmed
Changed in firefox (Debian):
status: Confirmed → Fix Released
Julian Taylor (jtaylor)
Changed in firefox (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.