From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9605142254.AA09283@nova.tat.physik.uni-tuebingen.de> Date: Tue, 14 May 1996 23:36:49 +0200 (MET DST) From: Harald Koenig Subject: Re: other gcc problem In-Reply-To: <199605142057.NAA05396@web.azstarnet.com> > Does that file have a large initialized array, by any chance? > I noticed that initialized arrays seem to take O(N^2) memory. no. does this initialisation depend of the optimisation level ? > An initialized array of several thousand entries is gonna blow > away 32MBs of memory just like nothing with gcc (that's one reason > MILO generates an assembly file instead). I think that has been a > problem ever since c++ support was added. cc1 only takes ~4.5MB memory and just sucks CPU time for 10+ minutes with -O -01 -O2 etc. (but not -O0). I've stripped down the source file and located the function which takes all the CPU time; below it is. this is extracted and a bit normalized from the original source file. if you define ONLY_2_SECONDS compilation with -O1 or -O2 will need ~2 seconds, every additional line will increase the CPU time needed dramatically... Harald ------------------------------------------------------------------------------- long func(long mask[2]) { long needbytes=0; if (mask[(( 0)/32)] & (((unsigned long)1) << (( 0) % 32))) needbytes += (4) ; if (mask[(( 1)/32)] & (((unsigned long)1) << (( 1) % 32))) needbytes += (4) ; if (mask[(( 2)/32)] & (((unsigned long)1) << (( 2) % 32))) needbytes += (4) ; if (mask[(( 3)/32)] & (((unsigned long)1) << (( 3) % 32))) needbytes += (4) ; if (mask[(( 4)/32)] & (((unsigned long)1) << (( 4) % 32))) needbytes += (4) ; if (mask[(( 5)/32)] & (((unsigned long)1) << (( 5) % 32))) needbytes += (4) ; if (mask[(( 6)/32)] & (((unsigned long)1) << (( 6) % 32))) needbytes += (24) ; if (mask[(( 7)/32)] & (((unsigned long)1) << (( 7) % 32))) needbytes += (24) ; if (mask[(( 8)/32)] & (((unsigned long)1) << (( 8) % 32))) needbytes += (20) ; if (mask[(( 9)/32)] & (((unsigned long)1) << (( 9) % 32))) needbytes += (20) ; if (mask[((10)/32)] & (((unsigned long)1) << ((10) % 32))) needbytes += (4) ; if (mask[((11)/32)] & (((unsigned long)1) << ((11) % 32))) needbytes += (4) ; if (mask[((12)/32)] & (((unsigned long)1) << ((12) % 32))) needbytes += (4) ; if (mask[((13)/32)] & (((unsigned long)1) << ((13) % 32))) needbytes += (4) ; if (mask[((14)/32)] & (((unsigned long)1) << ((14) % 32))) needbytes += (4) ; if (mask[((15)/32)] & (((unsigned long)1) << ((15) % 32))) needbytes += (4) ; if (mask[((16)/32)] & (((unsigned long)1) << ((16) % 32))) needbytes += (4) ; #ifndef ONLY_2_SECONDS if (mask[((17)/32)] & (((unsigned long)1) << ((17) % 32))) needbytes += (4) ; if (mask[((18)/32)] & (((unsigned long)1) << ((18) % 32))) needbytes += (4) ; if (mask[((19)/32)] & (((unsigned long)1) << ((19) % 32))) needbytes += (4) ; if (mask[((20)/32)] & (((unsigned long)1) << ((20) % 32))) needbytes += (4) ; if (mask[((21)/32)] & (((unsigned long)1) << ((21) % 32))) needbytes += (4) ; if (mask[((22)/32)] & (((unsigned long)1) << ((22) % 32))) needbytes += (4) ; if (mask[((23)/32)] & (((unsigned long)1) << ((23) % 32))) needbytes += (4) ; if (mask[((24)/32)] & (((unsigned long)1) << ((24) % 32))) needbytes += (4) ; if (mask[((25)/32)] & (((unsigned long)1) << ((25) % 32))) needbytes += (4) ; if (mask[((26)/32)] & (((unsigned long)1) << ((26) % 32))) needbytes += (4) ; if (mask[((27)/32)] & (((unsigned long)1) << ((27) % 32))) needbytes += (4) ; if (mask[((28)/32)] & (((unsigned long)1) << ((28) % 32))) needbytes += (4) ; if (mask[((29)/32)] & (((unsigned long)1) << ((29) % 32))) needbytes += (4) ; if (mask[((30)/32)] & (((unsigned long)1) << ((30) % 32))) needbytes += (4) ; if (mask[((31)/32)] & (((unsigned long)1) << ((31) % 32))) needbytes += (4) ; if (mask[((33)/32)] & (((unsigned long)1) << ((33) % 32))) needbytes += (4) ; if (mask[((32)/32)] & (((unsigned long)1) << ((32) % 32))) needbytes += (4) ; #endif return needbytes; } ------------------------------------------------------------------------------- -- All SCSI disks will from now on ___ _____ be required to send an email notice 0--,| /OOOOOOO\ 24 hours prior to complete hardware failure! <_/ / /OOOOOOOOOOO\ \ \/OOOOOOOOOOOOOOO\ \ OOOOOOOOOOOOOOOOO|// Harald Koenig, \/\/\/\/\/\/\/\/\/ Inst.f.Theoret.Astrophysik // / \\ \ koenig@tat.physik.uni-tuebingen.de ^^^^^ ^^^^^