#1 Enable LTO
Closed a month ago by frantisekz. Opened 2 months ago by atim.
rpms/ atim/mozjs60 master  into  master

file modified
+13 -1

@@ -1,3 +1,7 @@ 

+ # Enable LTO

+ %global optflags        %{optflags} -flto

+ %global build_ldflags   %{build_ldflags} -flto

+ 

  %global major 60

  

  # Require libatomic for ppc

@@ -12,7 +16,7 @@ 

  

  Name:           mozjs%{major}

  Version:        60.7.2

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        SpiderMonkey JavaScript library

  

  License:        MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2+ and AFL and ASL 2.0

@@ -104,6 +108,11 @@ 

  rm -rf ../../modules/zlib

  

  %build

+ # Enable LTO

+ export AR=%{_bindir}/gcc-ar

+ export RANLIB=%{_bindir}/gcc-ranlib

+ export NM=%{_bindir}/gcc-nm

+ 

  export CFLAGS="%{optflags}"

  

  export CXXFLAGS="$CFLAGS"

@@ -181,6 +190,9 @@ 

  %{_includedir}/mozjs-%{major}/

  

  %changelog

+ * Sun Jun 23 2019 Artem Polishchuk <ego.cordatus@gmail.com> - 60.7.2-2

+ - Enable LTO

+ 

  * Sat Jun 22 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 60.7.2-1

  - Update to 60.7.2

  

Is there any reason to not enable Link Time Optimization? Any performance boost matters there. No regression noticed.

COPR test build https://copr.fedorainfracloud.org/coprs/atim/mozjs60-performance/

I am not opposed to doing this, but just enabling LTO doesn't always automagically give you a performance boost (I am not sure if this is the case here).

I'll look more into this later this week and do some benchmarking and testing.
I was planning to enable LTO/PGO by default for upcoming mozjs68, If I am not mistaken, there were some fixes for this in newer Firefox versions.

@stransky @kalev WDYT about this?

Anyway, thanks for bringing this up!

I'd like to do the same as firefox does, to share bugs/issues. If firefox enables LTO then we should enable it in mozjs as well, I'd say.

PGO+LTO is already enabled in Fedora Firefox since Firefox 64. We have a gcc patch to PGO to generate proper training data for PGO profile. More details are available at http://hubicka.blogspot.com/

Thanks for reply, I was aware that LOT+PGO was enabled in Fedora Firefox. But this is effectively SpiderMonkey from Firefox 60 (version way older than where was LTO+PGO enabled).

Aren't you aware of any issues in such an old Firefox if it was built with LTO+PGO?

Thanks!

Thanks for reply, I was aware that LOT+PGO was enabled in Fedora Firefox. But this is effectively SpiderMonkey from Firefox 60 (version way older than where was LTO+PGO enabled).
Aren't you aware of any issues in such an old Firefox if it was built with LTO+PGO?

Only the one described in the referenced article. You can find related patches in Fedora Firefox.

Okay, I've pushed LTO enabled build right now [0] ( @atim credit is given in spec changelog). I did compare the perf by measuring time to run the test suite (not ideal, I know, the difference is tiny, but I wanted to be sure there aren't any regressions at least).

I'll soon fire up build also in F30 if F31 build finishes succesfully for all Fedora arches, but I am planning to let it live in updates-testing for a few days to be absolutely sure nothing got broken.

I have tried to fiddle with PGO a little, but mozjs60 is build in a completely different way than Firefox in Fedora and I wasn't too successful with getting PGO training to run. Firefox 68 ESR was released a few days ago, I am planning to use Firefox Fedora package as a base for mozjs68 , so we'll have LTO+PGO from there.

Having both LTO+PGO enabled in future mozjs68 should bring bigger perf gains.

[0] https://src.fedoraproject.org/rpms/mozjs60/c/5395cffee2cbc4c620fdbe4945e3604d356ddd6a?branch=master

Pull-Request has been closed by frantisekz

a month ago

Awesome. Yep, now waiting for mozjs68 and PGO. Thank you.