Closed Bug 1697502 (sw-wr-perf-opt-flags) Opened 4 years ago Closed 4 years ago

Compile with swgl with -O2 instead of -Oz on Android

Categories

(Core :: Graphics: WebRender, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: jrmuizel, Assigned: jrmuizel)

References

(Blocks 3 open bugs)

Details

Attachments

(1 file)

We need the compiled shared to be fast as possible.

Glandium, any suggestions for how to best accomplish this?

One option is adding something like:

diff --git a/gfx/wr/swgl/build.rs b/gfx/wr/swgl/build.rs
index 5a2ed57f55c91..7c2b454a4147c 100644
--- a/gfx/wr/swgl/build.rs
+++ b/gfx/wr/swgl/build.rs
@@ -134,11 +134,14 @@ fn main() {
     println!("cargo:rerun-if-changed=src/swgl_ext.h");
     println!("cargo:rerun-if-changed=src/texture.h");
     println!("cargo:rerun-if-changed=src/vector_type.h");
     println!("cargo:rerun-if-changed=src/gl.cc");
-    cc::Build::new()
-        .cpp(true)
-        .file("src/gl.cc")
+    let mut build = cc::Build::new();
+    build.cpp(true);
+    if build.get_compiler().args().contains(&std::ffi::OsString::from("-Oz")) {
+        build.flag("-O2");
+    }
+    build.file("src/gl.cc")
         .flag("-std=c++17")
         .flag("-UMOZILLA_CONFIG_H")
         .flag("-fno-exceptions")
         .flag("-fno-rtti")
Flags: needinfo?(mh+mozilla)
Assignee: nobody → jmuizelaar
Status: NEW → ASSIGNED
Pushed by jmuizelaar@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f87afcc0d272 Override -Oz with -O2 when building SWGL. r=lsalzman
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
Flags: needinfo?(mh+mozilla)
Blocks: 1697317
Alias: sw-wr-perf-opt-flags
Blocks: 1697885
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: