[intercu] Improve hash table size estimate

Daniel Jacobowitz drow@false.org
Sat Feb 21 21:02:00 GMT 2004


Just because your hash table supports expanding doesn't mean you should make
it do that.  This little change is good for another five percent or
thereabouts.  The estimate doesn't have to be particularly good, so I did
not spend a lot of time tuning it - it'll just get rounded up to the next
prime table size anyway.  At least now it scales with CU size.

Committed to the intercu branch.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2004-02-21  Daniel Jacobowitz  <drow@mvista.com>

	* dwarf2read.c (dwarf2_build_psymtabs_hard): Estimate the initial
	size of the hash table.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.135.2.7
diff -u -p -r1.135.2.7 dwarf2read.c
--- dwarf2read.c	21 Feb 2004 20:55:18 -0000	1.135.2.7
+++ dwarf2read.c	21 Feb 2004 20:59:24 -0000
@@ -1346,7 +1346,8 @@ dwarf2_build_psymtabs_hard (struct objfi
 
 	  obstack_init (&cu.partial_die_obstack);
 	  cu.partial_dies
-	    = htab_create_alloc_ex (29, partial_die_hash,
+	    = htab_create_alloc_ex (cu.header.length / 12,
+				    partial_die_hash,
 				    partial_die_eq,
 				    NULL,
 				    &cu.partial_die_obstack,



More information about the Gdb-patches mailing list