X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com Message-ID: <47572E5D.5030206@iki.fi> Date: Thu, 06 Dec 2007 01:03:57 +0200 From: Andris Pavenis User-Agent: Thunderbird 2.0.0.9 (X11/20071115) MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: gcc-4.3. snapshots and DJGPP memory allocator efficiency References: <47571B5D DOT 5090305 AT iki DOT fi> In-Reply-To: <47571B5D.5090305@iki.fi> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Andris Pavenis wrote: > There seem to be serious performance problems in GCC-4.3 for DJGPP due > to slowness of free() call especially for Ada compiler. > > Tried to bootstrap gcc-4.3-20071130 for DJGPP (after reverting some > earlier changes in libiberty/configure.ac present in snapshot). > Initially thought that compiler (gnat1.exe) has went into some infinite > loop when compiling gcc/ada/ali.adb for stage2. > > Found that extremly long time is being spent in libibrty/hashtab.c in > procedure htab_delete() which in that case uses free() to release > several millions allocated memory block. htab_delete() took perhaps > about 30 minutes on Intel Core 2 Quad 2.4GHz processor (I did not > measure accuratelly). There is of course not much use of 4 processor > cores as DJGPP cannot use them all. > > Currently I see that perhaps the same thing happens (I haven't verified > with debugger) when compiling gcc/ada/g-catiio.adb (killed after about > 60 minutes, I don't know how much it will still would require) > > Wrote simple test (see attachment). I'm getting from this test on mostly > idle machine (cannot get rid of WinXP though): > > for s in 50000 100000 150000 200000 250000; do ./memalloctest $s; done > 50000 0.055 0.000 0.440 > 100000 0.000 0.000 1.978 > 150000 0.055 0.000 5.055 > 200000 0.055 0.000 18.626 > 250000 0.055 0.000 41.868 > > So one can imagine what we'll get if the number will be some millions... For comparisson run the same program under Linux (on the same computer) with noticeably larger allocation counts: [andris AT ap Test]$ g++ -m32 -O2 memalloctest.cpp -o memalloctest [andris AT ap Test]$ for s in $(seq 1 10); do ./memalloctest $(($s*1000000)); done 1000000 0.070 0.050 0.180 2000000 0.170 0.160 0.360 3000000 0.260 0.210 0.550 4000000 0.330 0.320 0.790 5000000 0.430 0.430 1.000 6000000 0.520 0.580 1.250 7000000 0.600 0.670 1.410 8000000 0.640 0.820 1.630 9000000 0.730 0.970 1.980 10000000 0.910 1.120 2.200 So one can see that DJGPP version of free() performance is extremly bad.