This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
pending/975: [RFA] Use hash to speed up BINCL/INCL processing.
- From: Klee Dienes <klee at apple dot com>
- To: gdb-gnats at sources dot redhat dot com
- Date: Sun, 8 Dec 2002 04:42:03 -0500
- Subject: pending/975: [RFA] Use hash to speed up BINCL/INCL processing.
>Number: 975
>Category: pending
>Synopsis: [RFA] Use hash to speed up BINCL/INCL processing.
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Thu Jan 30 04:48:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:
>Release:
>Organization:
>Environment:
>Description:
--Apple-Mail-2-903781636
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
This increases the size of the temporary space used by BINCL/INCL
processing by 4 bytes per BINCL. The benefit is that it removes a huge
number of string compares when processing large numbers of BINCLs and
EXCLS.
2002-12-06 Klee Dienes <kdienes@apple.com>
* dbxread.c (header_file_location): New field 'hash'.
(add_bincl_to_list): Set the 'hash' field.
(find_corresponding_bincl_psymtab): Compute the hash of 'name'
and use that to pre-check the comparison.
--Apple-Mail-2-903781636
Content-Disposition: attachment;
filename=bincl-hash.txt
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
x-unix-mode=0644;
name="bincl-hash.txt"
2002-12-06 Klee Dienes <kdienes@apple.com>
* dbxread.c (header_file_location): New field 'hash'.
(add_bincl_to_list): Set the 'hash' field.
(find_corresponding_bincl_psymtab): Compute the hash of 'name'
and use that to pre-check the comparison.
Index: dbxread.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: =
/Volumes/Storage/Users/kdienes/source/cvs/cygnus/src/gdb/dbxread.c,v
retrieving revision 1.43
diff -u -r1.43 dbxread.c
--- dbxread.c 2002/12/01 22:22:03 1.43
+++ dbxread.c 2002/12/07 18:19:16
@@ -285,6 +285,7 @@
struct header_file_location
{
char *name; /* Name of header file */
+ unsigned long hash; /* Hashed value of 'name' */
int instance; /* See above */
struct partial_symtab *pst; /* Partial symtab that has the
BINCL/EINCL defs for this file */
@@ -1058,6 +1059,11 @@
return (nlist1.n_strx + stringtab_global + file_string_table_offset);
}
=0C
+
+/* Compute a hash value for a BINCL/EINCL filename string. */
+
+#define bincl_hash msymbol_hash
+
/* Initialize the list of bincls to contain none and have some
allocated. */
=20
@@ -1084,6 +1090,7 @@
next_bincl =3D bincl_list + offset;
}
next_bincl->pst =3D pst;
+ next_bincl->hash =3D bincl_hash (name);
next_bincl->instance =3D instance;
next_bincl++->name =3D name;
}
@@ -1096,9 +1103,11 @@
find_corresponding_bincl_psymtab (char *name, int instance)
{
struct header_file_location *bincl;
+ unsigned long hash =3D bincl_hash (name);
=20
for (bincl =3D bincl_list; bincl < next_bincl; bincl++)
- if (bincl->instance =3D=3D instance
+ if ((bincl->hash =3D=3D hash)
+ && (bincl->instance =3D=3D instance)
&& STREQ (name, bincl->name))
return bincl->pst;
=20
--Apple-Mail-2-903781636--
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: