Article View: comp.lang.c
Article #1180Re: speeding up compilation time
From: fir
Date: Fri, 30 Oct 2026 18:55
Date: Fri, 30 Oct 2026 18:55
251 lines
20832 bytes
20832 bytes
fir pisze: > fir pisze: >> very stupid by compilers btw not to show compile time each time btw >> >> then people culd see if they add something or change compielr version >> pc or flag how those times change THOU WAIT there is some timer >> >> >> >gcc program.c -o program.exe -O2 -s -w -msse2 -ffast-math >> -mfpmath=sse -fno-math-errno -fomit-frame-pointer >> -fsingle-precision-constant -fno-exceptions -fno-rtti >> -fno-threadsafe-statics -fno-unwind-tables >> -fno-asynchronous-unwind-tables -fmerge-constants -fno-ident >> -Wl,--gc-sections -Wl,--strip-all -mwindows -lgdi32 -lpsapi >> -Wl,--stack,8388608 -lwinmm -luser32 -lcomctl32 -ftime-report >> >> Execution times (seconds) >> phase setup : 0.01 ( 0%) usr 683 kB ( 0%) ggc >> phase parsing : 0.32 ( 3%) usr 19421 kB (10%) ggc >> phase opt and generate : 11.06 (97%) usr 181918 kB (90%) ggc >> dump files : 0.02 ( 0%) usr 0 kB ( 0%) ggc >> callgraph construction : 0.03 ( 0%) usr 2961 kB ( 1%) ggc >> callgraph optimization : 0.03 ( 0%) usr 367 kB ( 0%) ggc >> ipa cp : 0.02 ( 0%) usr 1559 kB ( 1%) ggc >> ipa inlining heuristics : 0.06 ( 1%) usr 1285 kB ( 1%) ggc >> ipa function splitting : 0.06 ( 0%) usr 3846 kB ( 2%) ggc >> ipa profile : 0.01 ( 0%) usr 0 kB ( 0%) ggc >> ipa pure const : 0.01 ( 0%) usr 57 kB ( 0%) ggc >> ipa icf : 0.02 ( 0%) usr 52 kB ( 0%) ggc >> cfg construction : 0.01 ( 0%) usr 276 kB ( 0%) ggc >> cfg cleanup : 0.11 ( 1%) usr 508 kB ( 0%) ggc >> trivially dead code : 0.09 ( 1%) usr 0 kB ( 0%) ggc >> df scan insns : 0.08 ( 1%) usr 49 kB ( 0%) ggc >> df multiple defs : 0.03 ( 0%) usr 0 kB ( 0%) ggc >> df reaching defs : 0.07 ( 1%) usr 0 kB ( 0%) ggc >> df live regs : 0.37 ( 3%) usr 0 kB ( 0%) ggc >> df live&initialized regs: 0.09 ( 1%) usr 0 kB ( 0%) ggc >> df use-def / def-use chains: 0.03 ( 0%) usr 0 kB ( 0%) ggc >> df reg dead/unused notes: 0.20 ( 2%) usr 2588 kB ( 1%) ggc >> register information : 0.05 ( 0%) usr 0 kB ( 0%) ggc >> alias analysis : 0.14 ( 1%) usr 6652 kB ( 3%) ggc >> alias stmt walking : 0.34 ( 3%) usr 496 kB ( 0%) ggc >> register scan : 0.02 ( 0%) usr 74 kB ( 0%) ggc >> rebuild jump labels : 0.03 ( 0%) usr 0 kB ( 0%) ggc >> preprocessing : 0.14 ( 1%) usr 6865 kB ( 3%) ggc >> lexical analysis : 0.02 ( 0%) usr 0 kB ( 0%) ggc >> parser (global) : 0.07 ( 1%) usr 6549 kB ( 3%) ggc >> parser struct body : 0.02 ( 0%) usr 1402 kB ( 1%) ggc >> parser function body : 0.05 ( 0%) usr 4102 kB ( 2%) ggc >> parser inl. func. body : 0.01 ( 0%) usr 375 kB ( 0%) ggc >> early inlining heuristics: 0.02 ( 0%) usr 3482 kB ( 2%) ggc >> inline parameters : 0.04 ( 0%) usr 932 kB ( 0%) ggc >> integration : 0.12 ( 1%) usr 12793 kB ( 6%) ggc >> tree gimplify : 0.07 ( 1%) usr 5904 kB ( 3%) ggc >> tree eh : 0.01 ( 0%) usr 68 kB ( 0%) ggc >> tree CFG construction : 0.01 ( 0%) usr 1382 kB ( 1%) ggc >> tree CFG cleanup : 0.11 ( 1%) usr 317 kB ( 0%) ggc >> tree tail merge : 0.02 ( 0%) usr 2 kB ( 0%) ggc >> tree VRP : 0.19 ( 2%) usr 4235 kB ( 2%) ggc >> tree copy propagation : 0.03 ( 0%) usr 16 kB ( 0%) ggc >> tree PTA : 0.22 ( 2%) usr 204 kB ( 0%) ggc >> tree PHI insertion : 0.01 ( 0%) usr 362 kB ( 0%) ggc >> tree SSA rewrite : 0.05 ( 0%) usr 3686 kB ( 2%) ggc >> tree SSA other : 0.01 ( 0%) usr 69 kB ( 0%) ggc >> tree SSA incremental : 0.11 ( 1%) usr 1415 kB ( 1%) ggc >> tree operand scan : 0.05 ( 0%) usr 7835 kB ( 4%) ggc >> dominator optimization : 0.16 ( 1%) usr 4411 kB ( 2%) ggc >> tree SRA : 0.06 ( 1%) usr 3134 kB ( 2%) ggc >> tree CCP : 0.14 ( 1%) usr 176 kB ( 0%) ggc >> tree split crit edges : 0.01 ( 0%) usr 1084 kB ( 1%) ggc >> tree reassociation : 0.03 ( 0%) usr 206 kB ( 0%) ggc >> tree PRE : 0.41 ( 4%) usr 6591 kB ( 3%) ggc >> tree FRE : 0.31 ( 3%) usr 4373 kB ( 2%) ggc >> tree code sinking : 0.01 ( 0%) usr 401 kB ( 0%) ggc >> tree linearize phis : 0.01 ( 0%) usr 439 kB ( 0%) ggc >> tree forward propagate : 0.08 ( 1%) usr 391 kB ( 0%) ggc >> tree conservative DCE : 0.02 ( 0%) usr 25 kB ( 0%) ggc >> tree aggressive DCE : 0.05 ( 0%) usr 1133 kB ( 1%) ggc >> tree DSE : 0.06 ( 1%) usr 16 kB ( 0%) ggc >> tree loop bounds : 0.01 ( 0%) usr 161 kB ( 0%) ggc >> tree loop invariant motion: 0.03 ( 0%) usr 93 kB ( 0%) ggc >> tree canonical iv : 0.01 ( 0%) usr 246 kB ( 0%) ggc >> scev constant prop : 0.01 ( 0%) usr 189 kB ( 0%) ggc >> complete unrolling : 0.04 ( 0%) usr 832 kB ( 0%) ggc >> tree iv optimization : 0.10 ( 1%) usr 2644 kB ( 1%) ggc >> tree SSA uncprop : 0.02 ( 0%) usr 0 kB ( 0%) ggc >> tree rename SSA copies : 0.01 ( 0%) usr 0 kB ( 0%) ggc >> dominance computation : 0.15 ( 1%) usr 0 kB ( 0%) ggc >> out of ssa : 0.03 ( 0%) usr 48 kB ( 0%) ggc >> expand vars : 0.03 ( 0%) usr 1135 kB ( 1%) ggc >> expand : 0.22 ( 2%) usr 25190 kB (12%) ggc >> post expand cleanups : 0.02 ( 0%) usr 605 kB ( 0%) ggc >> forward prop : 0.11 ( 1%) usr 3741 kB ( 2%) ggc >> CSE : 0.51 ( 5%) usr 1042 kB ( 1%) ggc >> dead code elimination : 0.05 ( 0%) usr 0 kB ( 0%) ggc >> dead store elim1 : 0.14 ( 1%) usr 3117 kB ( 2%) ggc >> dead store elim2 : 0.15 ( 1%) usr 3341 kB ( 2%) ggc >> loop init : 0.12 ( 1%) usr 3363 kB ( 2%) ggc >> loop invariant motion : 0.01 ( 0%) usr 54 kB ( 0%) ggc >> loop fini : 0.01 ( 0%) usr 0 kB ( 0%) ggc >> CPROP : 0.23 ( 2%) usr 3814 kB ( 2%) ggc >> PRE : 0.11 ( 1%) usr 321 kB ( 0%) ggc >> CSE 2 : 0.28 ( 2%) usr 349 kB ( 0%) ggc >> branch prediction : 0.03 ( 0%) usr 430 kB ( 0%) ggc >> combiner : 0.39 ( 3%) usr 7669 kB ( 4%) ggc >> if-conversion : 0.02 ( 0%) usr 188 kB ( 0%) ggc >> integrated RA : 0.75 ( 7%) usr 21603 kB (11%) ggc >> LRA non-specific : 0.37 ( 3%) usr 3004 kB ( 1%) ggc >> LRA virtuals elimination: 0.04 ( 0%) usr 1575 kB ( 1%) ggc >> LRA reload inheritance : 0.05 ( 0%) usr 910 kB ( 0%) ggc >> LRA create live ranges : 0.24 ( 2%) usr 465 kB ( 0%) ggc >> LRA hard reg assignment : 0.11 ( 1%) usr 0 kB ( 0%) ggc >> LRA rematerialization : 0.04 ( 0%) usr 24 kB ( 0%) ggc >> reload : 0.01 ( 0%) usr 0 kB ( 0%) ggc >> reload CSE regs : 0.46 ( 4%) usr 4412 kB ( 2%) ggc >> thread pro- & epilogue : 0.05 ( 0%) usr 1071 kB ( 1%) ggc >> if-conversion 2 : 0.01 ( 0%) usr 7 kB ( 0%) ggc >> peephole 2 : 0.04 ( 0%) usr 403 kB ( 0%) ggc >> hard reg cprop : 0.05 ( 0%) usr 29 kB ( 0%) ggc >> scheduling 2 : 0.71 ( 6%) usr 559 kB ( 0%) ggc >> reorder blocks : 0.05 ( 0%) usr 753 kB ( 0%) ggc >> shorten branches : 0.07 ( 1%) usr 1 kB ( 0%) ggc >> reg stack : 0.01 ( 0%) usr 127 kB ( 0%) ggc >> final : 0.37 ( 3%) usr 81 kB ( 0%) ggc >> variable output : 0.01 ( 0%) usr 73 kB ( 0%) ggc >> straight-line strength reduction: 0.01 ( 0%) usr 290 kB ( 0%) ggc >> rest of compilation : 0.23 ( 2%) usr 1721 kB ( 1%) ggc >> remove unused locals : 0.03 ( 0%) usr 6 kB ( 0%) ggc >> address taken : 0.02 ( 0%) usr 0 kB ( 0%) ggc >> unaccounted todo : 0.11 ( 1%) usr 0 kB ( 0%) ggc >> TOTAL : 11.39 202069 kB >> >> > O1 for comparsion > > > >gcc program.c -o program.exe -O1 -s -w -msse2 -ffast-math > -mfpmath=sse -fno-math-errno -fomit-frame-pointer > -fsingle-precision-constant -fno-exceptions -fno-rtti > -fno-threadsafe-statics -fno-unwind-tables > -fno-asynchronous-unwind-tables -fmerge-constants -fno-ident > -Wl,--gc-sections -Wl,--strip-all -mwindows -lgdi32 -lpsapi > -Wl,--stack,8388608 -lwinmm -luser32 -lcomctl32 -ftime-report > > Execution times (seconds) > phase parsing : 0.27 ( 5%) usr 19421 kB (15%) ggc > phase opt and generate : 5.30 (95%) usr 107519 kB (84%) ggc > phase last asm : 0.01 ( 0%) usr 6 kB ( 0%) ggc > dump files : 0.01 ( 0%) usr 0 kB ( 0%) ggc > callgraph construction : 0.03 ( 1%) usr 2552 kB ( 2%) ggc > callgraph optimization : 0.02 ( 0%) usr 367 kB ( 0%) ggc > ipa inlining heuristics : 0.07 ( 1%) usr 2817 kB ( 2%) ggc > ipa pure const : 0.02 ( 0%) usr 106 kB ( 0%) ggc > cfg construction : 0.01 ( 0%) usr 135 kB ( 0%) ggc > cfg cleanup : 0.04 ( 1%) usr 35 kB ( 0%) ggc > trivially dead code : 0.05 ( 1%) usr 0 kB ( 0%) ggc > df scan insns : 0.11 ( 2%) usr 45 kB ( 0%) ggc > df multiple defs : 0.02 ( 0%) usr 0 kB ( 0%) ggc > df reaching defs : 0.01 ( 0%) usr 0 kB ( 0%) ggc > df live regs : 0.13 ( 2%) usr 0 kB ( 0%) ggc > df live&initialized regs: 0.03 ( 0%) usr 0 kB ( 0%) ggc > df use-def / def-use chains: 0.01 ( 0%) usr 0 kB ( 0%) ggc > df reg dead/unused notes: 0.12 ( 2%) usr 1504 kB ( 1%) ggc > register information : 0.02 ( 0%) usr 0 kB ( 0%) ggc > alias analysis : 0.05 ( 1%) usr 2562 kB ( 2%) ggc > alias stmt walking : 0.17 ( 3%) usr 223 kB ( 0%) ggc > register scan : 0.01 ( 0%) usr 174 kB ( 0%) ggc > rebuild jump labels : 0.01 ( 0%) usr 0 kB ( 0%) ggc > preprocessing : 0.12 ( 2%) usr 6865 kB ( 5%) ggc > lexical analysis : 0.02 ( 0%) usr 0 kB ( 0%) ggc > parser (global) : 0.04 ( 1%) usr 6549 kB ( 5%) ggc > parser struct body : 0.02 ( 0%) usr 1402 kB ( 1%) ggc > parser function body : 0.05 ( 1%) usr 4102 kB ( 3%) ggc > parser inl. func. body : 0.01 ( 0%) usr 375 kB ( 0%) ggc > early inlining heuristics: 0.01 ( 0%) usr 1306 kB ( 1%) ggc > inline parameters : 0.03 ( 1%) usr 909 kB ( 1%) ggc > integration : 0.05 ( 1%) usr 6252 kB ( 5%) ggc > tree gimplify : 0.05 ( 1%) usr 5904 kB ( 5%) ggc > tree eh : 0.01 ( 0%) usr 68 kB ( 0%) ggc > tree CFG construction : 0.01 ( 0%) usr 1382 kB ( 1%) ggc > tree CFG cleanup : 0.10 ( 2%) usr 52 kB ( 0%) ggc > tree copy propagation : 0.04 ( 1%) usr 14 kB ( 0%) ggc > tree PTA : 0.14 ( 2%) usr 102 kB ( 0%) ggc > tree SSA rewrite : 0.02 ( 0%) usr 2585 kB ( 2%) ggc > tree SSA other : 0.02 ( 0%) usr 69 kB ( 0%) ggc > tree SSA incremental : 0.04 ( 1%) usr 210 kB ( 0%) ggc > tree operand scan : 0.02 ( 0%) usr 4747 kB ( 4%) ggc > dominator optimization : 0.10 ( 2%) usr 1829 kB ( 1%) ggc > tree SRA : 0.04 ( 1%) usr 2644 kB ( 2%) ggc > tree CCP : 0.10 ( 2%) usr 186 kB ( 0%) ggc > tree reassociation : 0.05 ( 1%) usr 203 kB ( 0%) ggc > tree FRE : 0.18 ( 3%) usr 2782 kB ( 2%) ggc > tree linearize phis : 0.01 ( 0%) usr 407 kB ( 0%) ggc > tree forward propagate : 0.06 ( 1%) usr 319 kB ( 0%) ggc > tree conservative DCE : 0.02 ( 0%) usr 15 kB ( 0%) ggc > tree aggressive DCE : 0.01 ( 0%) usr 23 kB ( 0%) ggc > tree DSE : 0.02 ( 0%) usr 0 kB ( 0%) ggc > tree loop bounds : 0.01 ( 0%) usr 147 kB ( 0%) ggc > tree loop invariant motion: 0.02 ( 0%) usr 7 kB ( 0%) ggc > tree canonical iv : 0.01 ( 0%) usr 213 kB ( 0%) ggc > scev constant prop : 0.01 ( 0%) usr 133 kB ( 0%) ggc > complete unrolling : 0.01 ( 0%) usr 349 kB ( 0%) ggc > tree iv optimization : 0.10 ( 2%) usr 2304 kB ( 2%) ggc > tree copy headers : 0.01 ( 0%) usr 285 kB ( 0%) ggc > dominance computation : 0.09 ( 2%) usr 0 kB ( 0%) ggc > out of ssa : 0.03 ( 0%) usr 22 kB ( 0%) ggc > expand vars : 0.01 ( 0%) usr 920 kB ( 1%) ggc > expand : 0.15 ( 3%) usr 17864 kB (14%) ggc > post expand cleanups : 0.02 ( 0%) usr 487 kB ( 0%) ggc > forward prop : 0.08 ( 1%) usr 1609 kB ( 1%) ggc > CSE : 0.19 ( 3%) usr 304 kB ( 0%) ggc > dead code elimination : 0.03 ( 1%) usr 0 kB ( 0%) ggc > dead store elim1 : 0.11 ( 2%) usr 2263 kB ( 2%) ggc > dead store elim2 : 0.11 ( 2%) usr 2460 kB ( 2%) ggc > loop init : 0.04 ( 1%) usr 2610 kB ( 2%) ggc > loop invariant motion : 0.01 ( 0%) usr 78 kB ( 0%) ggc > loop fini : 0.01 ( 0%) usr 0 kB ( 0%) ggc > branch prediction : 0.02 ( 0%) usr 417 kB ( 0%) ggc > combiner : 0.26 ( 5%) usr 4658 kB ( 4%) ggc > if-conversion : 0.01 ( 0%) usr 68 kB ( 0%) ggc > integrated RA : 0.51 ( 9%) usr 16981 kB (13%) ggc > LRA non-specific : 0.31 ( 6%) usr 2616 kB ( 2%) ggc > LRA virtuals elimination: 0.03 ( 1%) usr 1363 kB ( 1%) ggc > LRA reload inheritance : 0.03 ( 1%) usr 637 kB ( 0%) ggc > LRA create live ranges : 0.09 ( 2%) usr 405 kB ( 0%) ggc > LRA hard reg assignment : 0.05 ( 1%) usr 0 kB ( 0%) ggc > reload : 0.01 ( 0%) usr 0 kB ( 0%) ggc > reload CSE regs : 0.20 ( 4%) usr 1821 kB ( 1%) ggc > thread pro- & epilogue : 0.04 ( 1%) usr 1078 kB ( 1%) ggc > if-conversion 2 : 0.01 ( 0%) usr 2 kB ( 0%) ggc > combine stack adjustments: 0.01 ( 0%) usr 0 kB ( 0%) ggc > hard reg cprop : 0.05 ( 1%) usr 30 kB ( 0%) ggc > shorten branches : 0.06 ( 1%) usr 1 kB ( 0%) ggc > reg stack : 0.01 ( 0%) usr 140 kB ( 0%) ggc > final : 0.23 ( 4%) usr 26 kB ( 0%) ggc > variable output : 0.02 ( 0%) usr 24 kB ( 0%) ggc > straight-line strength reduction: 0.01 ( 0%) usr 41 kB ( 0%) ggc > rest of compilation : 0.17 ( 3%) usr 1370 kB ( 1%) ggc > remove unused locals : 0.02 ( 0%) usr 0 kB ( 0%) ggc > address taken : 0.01 ( 0%) usr 0 kB ( 0%) ggc > unaccounted todo : 0.06 ( 1%) usr 0 kB ( 0%) ggc > TOTAL : 5.58 127638 kB > using this #ifdef and -O1 together cut this time down to 2s so its ok i dont know what those numbers with kilobytes mean though, also it seem there is no version with only final time provided and i would like to see only that ime mostly there is also a question if i should generally compile with -O1 generally O2 not improves much like 27 ms down to 26 ms so maybe i should
Technical Details
Message-ID:
<11c2p6m$gv8g$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11c2ic7$e7ic$1@dont-email.me> <11c2nfs$g9b6$1@dont-email.me> <11c2nqc$gdhd$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: fir <profesor.fir@gmail.com> Newsgroups: comp.lang.c Subject: Re: speeding up compilation time Date: Fri, 30 Oct 2026 19:55:18 +0100 Organization: A noiseless patient Spider Lines: 251 Message-ID: <11c2p6m$gv8g$1@dont-email.me> References: <11c2ic7$e7ic$1@dont-email.me> <11c2nfs$g9b6$1@dont-email.me> <11c2nqc$gdhd$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 30 Oct 2026 18:55:19 +0000 (UTC) Injection-Info: dont-email.me; logging-data="556304"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sMFVIrpz79aAIgRMCNyr2YqDIKM0XD+g="; posting-host="eff870502cf07dcc3c4d1304454792c4" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0 SeaMonkey/2.53.24 Cancel-Lock: sha1:Bq3S40V7Nk+mwnfsPzgz1y5piSU= sha256:OoJIEb9F+SEmd3OMF9Y7D5EyoAimqQ2EEv0a/sOfpE8= sha1:35NJl7DHl8o8p9UVfneINRbrVH4= sha256:0xAs94pTMio0Z3LKwtnK0pvJlPVVJJmOVk04QMTTmAs= In-Reply-To: <11c2nqc$gdhd$1@dont-email.me>