From b76dff9fbc78f1fcbe1da91d35171f09b937d506 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 12 Feb 2024 21:28:03 +0000 Subject: xap_helper_cxx: -O2 optimize read-only files by default While fast build times from -O0 is critical to my sanity when actively working on C++, the files installed via package managers or `make install' aren't likely to change frequently. In that case, expensive -O2 optimizations make sense since the 10-20s saved from a single large --join more than covers the cost of waiting on g++ to optimize. --- lib/PublicInbox/XapHelperCxx.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PublicInbox/XapHelperCxx.pm b/lib/PublicInbox/XapHelperCxx.pm index 6bd165b8..eafe61a8 100644 --- a/lib/PublicInbox/XapHelperCxx.pm +++ b/lib/PublicInbox/XapHelperCxx.pm @@ -30,6 +30,7 @@ my $xflags = ($ENV{CXXFLAGS} // '-Wall -ggdb3 -pipe') . ' ' . ' -DXH_SPEC="'.join('', map { s/=.*/:/; $_ } @PublicInbox::Search::XH_SPEC) . '" ' . ($ENV{LDFLAGS} // $ldflags); +substr($xflags, 0, 0, '-O2 ') if !defined($ENV{CXXFLAGS}) && !-w __FILE__; my $xap_modversion; sub xap_cfg (@) { -- cgit v1.2.3-24-ge0c7