Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 16548 - Trivial patch for GCC 3.2.x to speed up compilation
Summary: Trivial patch for GCC 3.2.x to speed up compilation
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-28 06:16 UTC by Garen
Modified: 2003-03-23 10:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Garen 2003-02-28 06:16:39 UTC
This is from the gcc-3_2-branch, which will be included in 3.2.3 if there ever is one (and 
the upcoming 3.3).  It decreases the number of times the collector has to be run by 
increasing its memory workspace: 
 
--- gcc-3.2.2/gcc/ggc-page.c    2003-02-28 01:27:12.000000000 -0800 
+++ gcc-3_2-branch/gcc/ggc-page.c       2002-01-05 14:11:21.000000000 -0800 
@@ -346,9 +346,9 @@ 
    one) before collection is performed.  */ 
 #define GGC_MIN_EXPAND_FOR_GC (1.3) 
 
-/* Bound `allocated_last_gc' to 16MB, to prevent the memory expansion 
+/* Bound `allocated_last_gc' to 4MB, to prevent the memory expansion 
    test from triggering too often when the heap is small.  */ 
-#define GGC_MIN_LAST_ALLOCATED (16 * 1024 * 1024) 
+#define GGC_MIN_LAST_ALLOCATED (4 * 1024 * 1024) 
 
 /* Allocate pages in chunks of this size, to throttle calls to memory 
    allocation routines.  The first page is used, the rest go onto the
Comment 1 Garen 2003-02-28 06:28:40 UTC
Sigh. I wish this thing had a preview/edit.  That patch will make it worse. 
 
This is the right one: 
 
--- gcc-3.2.2/gcc/ggc-page.c    2003-02-28 01:27:12.000000000 -0800 
+++ gcc-3_2-branch/gcc/ggc-page.c       2002-01-05 14:11:21.000000000 -0800 
@@ -346,9 +346,9 @@ 
    one) before collection is performed.  */ 
-#define GGC_MIN_EXPAND_FOR_GC (1.3) 
+#define GGC_MIN_EXPAND_FOR_GC (2.0) 
 
-/* Bound `allocated_last_gc' to 16MB, to prevent the memory expansion 
+/* Bound `allocated_last_gc' to 32MB, to prevent the memory expansion 
    test from triggering too often when the heap is small.  */ 
-#define GGC_MIN_LAST_ALLOCATED (16 * 1024 * 1024) 
+#define GGC_MIN_LAST_ALLOCATED (32 * 1024 * 1024) 
 
 /* Allocate pages in chunks of this size, to throttle calls to memory 
    allocation routines.  The first page is used, the rest go onto the 
 
Comment 2 Garen 2003-02-28 07:10:17 UTC
I see what went wrong.  This patch listed from the 3.2.2-r1 ebuild has: 
 
        # Update to support TLS and __thread 
        epatch ${DISTDIR}/${P}-tls-update.patch.bz2 
 
Which includes more than TLS and __thread.  Presumably it comes from an older snapshot of 
3-2_branch.  It has a similar patch: 
 
--- gcc-3.2.2/gcc/ggc-page.c    2002-01-06 00:11:21.000000000 +0200 
+++ gcc-3.2.2-20030218/gcc/ggc-page.c   2003-02-04 13:52:50.000000000 +0200 
@@ -346,9 +346,9 @@ 
    one) before collection is performed.  */ 
 #define GGC_MIN_EXPAND_FOR_GC (1.3) 
 
-/* Bound `allocated_last_gc' to 4MB, to prevent the memory expansion 
+/* Bound `allocated_last_gc' to 16MB, to prevent the memory expansion 
    test from triggering too often when the heap is small.  */ 
-#define GGC_MIN_LAST_ALLOCATED (4 * 1024 * 1024) 
+#define GGC_MIN_LAST_ALLOCATED (16 * 1024 * 1024) 
 
Which doesn't touch GGC_MIN_EXPAND_FOR_GC. 
 
Comment 3 Garen 2003-02-28 07:19:50 UTC
What is TLS anyway?  Top Level Sources? 
If the TLS patch is merely a diff between 3.2.2 and an older snapshot of the 3.2_branch, then if 
its updated to be more recent, then the stuff I listed will be included. 
 
So far I've seen a 20-50% reduiction in compilation time, more gains on larger files. 
 
Comment 4 Martin Schlemmer (RETIRED) gentoo-dev 2003-02-28 10:05:05 UTC
Thread Local Storage ... needed for NPTL (linuxthreads2) support ...
Comment 5 Garen 2003-02-28 14:41:47 UTC
Ah ok.  Well the ggc-page patch makes a nice difference.  
I also think it's reasonable to expect that Gentooers have got more than 4 and 16mb of ram. : ) 
 
Comment 6 Martin Schlemmer (RETIRED) gentoo-dev 2003-03-23 10:41:24 UTC
Added to 3.2.2-r2