This is the mail archive of the
mailing list for the GCC project.
Re: PATCH: Improve ht use
- From: Geoff Keating <geoffk at geoffk dot org>
- To: Devang Patel <dpatel at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 15 Feb 2003 21:11:00 -0800
- Subject: Re: PATCH: Improve ht use
- References: <6E302184-407A-11D7-AFCB-0003935AAA26@apple.com>
Devang Patel <firstname.lastname@example.org> writes:
> In tree.c, type_hash_table exhibits poor collision per search ratio
> (more than one per search). And Inliner can reuse hash table
> it uses during tree walk. This simple patch squeezes ~1%
> from Finder_FE build time.
> 2003-02-14 Devang Patel <email@example.com>
> * tree-inline.c (optimize_inline_calls): Reuse id.tree_pruner
> hash table.
> * tree.c (TYPE_HASH_INITIAL_SIZE): Increase initial size to 4111.
> OK to commit ?
I don't understand how, in a Finder_FE build using PCH, the first
change (to TYPE_HASH_INITIAL_SIZE) can save any time. type_hash_table
will be restored from the PCH file so it should always start with a
size of many thousands.
The second part isn't OK as written. 'id' is a local variable of
optimize_inline_calls, so id.tree_pruner will always be NULL (since it
is set to zero at the top of the routine) and not calling htab_delete
causes a memory leak.
[Could you take care to send future patches as context diffs?]
> Index: tree.c
> RCS file: /cvsroot/gcc/gcc/gcc/tree.c,v
> retrieving revision 1.289
> diff -r1.289 tree.c
> < #define TYPE_HASH_INITIAL_SIZE 1000
> > #define TYPE_HASH_INITIAL_SIZE 4111
> Index: tree-inline.c
> RCS file: /cvsroot/gcc/gcc/gcc/tree-inline.c,v
> retrieving revision 1.43
> diff -r1.43 tree-inline.c
> < id.tree_pruner = htab_create (37, htab_hash_pointer,
> < htab_eq_pointer, NULL);
> > if (!id.tree_pruner)
> > id.tree_pruner = htab_create (131, htab_hash_pointer,
> > htab_eq_pointer, NULL);
> < htab_delete (id.tree_pruner);
> > htab_empty (id.tree_pruner);
- Geoffrey Keating <firstname.lastname@example.org>