bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

compile cairo/pixman with full speed optimization




11 years ago
a year ago


(Reporter: vlad, Assigned: vlad)



Firefox Tracking Flags

(Not tracked)



(1 attachment)

Created attachment 270959 [details] [diff] [review]
optimize cairo/pixman for speed, not space

I saw some significant codegen differences when cairo was compiled with -O2 vs. -O1 (optimize for speed instead of our default optimize for space).  In particular, the _cairo_lround function which is used in some critical paths (win32 glyph drawing for one) is very expensive with -O1 but is inconsequential with -O2 (like 2500ms -> 30ms for a simple benchmark of the function).

This patch enables speed optimizations for cairo and pixman.  I don't know what the codesize hit would be, mind you, but I'm pretty sure that we should take it.
Attachment #270959 - Flags: superreview?(pavlov)
Attachment #270959 - Flags: review?(roc)

Comment 1

11 years ago
Do we trust GCC with -O3?

Comment 2

11 years ago
Gentoo's compilation optimization guide says "In 3.x, -O3 has been shown to lead to marginally faster execution times over -O2, but this is no longer the case with gcc 4.x."

Feel free to draw you own conclusions, but mine is that if -O2 gives the 2500ms -> 30ms jump, then stick with it, -O3 probably isn't needed.

(also, perhaps -Os should be benchmarked... it includes many of the optimizations in -O2 over -O1, and possibly the one that matters here is one of those)

Comment 3

11 years ago
Comment on attachment 270959 [details] [diff] [review]
optimize cairo/pixman for speed, not space

would it be better to optimize all of gfx this way?

Comment 4

11 years ago
2500ms -> 30ms by changing optimization options?  Wow.  I wonder if the gcc team would consider that a bug.
Summary: comile cairo/pixman with full speed optimization → compile cairo/pixman with full speed optimization
-O2 should be fine for gcc -- I was more speaking in terms of -O2 for msvc.  The optimization block is what we use in a few other places where we want to compile with optimizations: sqlite and some other bits, though -O3 for gcc is probably a leftover from gcc 3.x.

The 2500ms -> 30ms was under win32 msvc; it might or might not be a bug.  That is, there was a significant performance gain from no optimizations to optimize-size, and another from optimize-size to optimize-speed; the function probably is a little bigger.
FWIW, MS recommends you use -O2 over -Ox


11 years ago
Attachment #270959 - Flags: superreview?(pavlov) → superreview+
Checked in with -O2 for both gcc and msvc.
Last Resolved: 11 years ago
Resolution: --- → FIXED


7 years ago
Assignee: nobody → vladimir
You need to log in before you can comment on or make changes to this bug.