This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Improve ht use


Devang Patel <dpatel@apple.com> writes:

> Hi,
> 
> 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 <dpatel@apple.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 ?
> 3.3?

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?]

> -Devang
> 
> Index: tree.c
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/tree.c,v
> retrieving revision 1.289
> diff -r1.289 tree.c
> 109c109
> < #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
> 1440,1441c1440,1442
> <   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);
> 1445c1446
> <   htab_delete (id.tree_pruner);
> ---
>  >   htab_empty (id.tree_pruner);
> 
> 

-- 
- Geoffrey Keating <geoffk@geoffk.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]