public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Matt Austern <austern@apple.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Committed] Use special-purpose hash table to speed up walk_tree
Date: Sat, 16 Oct 2004 10:17:00 -0000	[thread overview]
Message-ID: <20041016094708.GZ31909@devserv.devel.redhat.com> (raw)
In-Reply-To: <F96640A6-1E36-11D9-9854-000A95AA5E5E@apple.com>

On Thu, Oct 14, 2004 at 04:15:44PM -0700, Matt Austern wrote:
> This patch isn't really as big as it looks.  walk_tree allows you to 
> provide a hash table to keep track of which nodes have already been 
> seen.  We were using htab_t, a general-purpose hash table with lots of 
> knobs for the client to tweak.  This patch replaces it with a 
> special-purpose hash table that has no more functionality than 
> walk_tree needs.  In particular, this special-purpose hash table 
> doesn't support deletion, doesn't give its client control over resizing 
> policy, and doesn't allow its client to specify the hash function or 
> equality function.  (It just uses the values of the pointers 
> themselves.)
> 
> Bootstrapped and tested (C, C++, Java) on powerpc-apple-darwin.  This 
> gives a 2% speedup on building QT.

But on x86-64-redhat-linux essentially makes even bootstrap impossible
(well, I have killed it after it spent more than 10 minutes compiling
insn-recog or insn-attrtab by stage1/cc1).
hash1's distribution is less than perfect.

I have gathered statistics taken from the hash table at a random time
I Ctrl-C cc1 compiling insn-recog.c.

{log_slots = 16, n_slots = 65536, n_elements = 16385, slots = 0x2a9b261010}
average chain length 7991
hash 21703 count 887
hash 21705 count 882
hash 21704 count 856
hash 21706 count 817
hash 21702 count 780
hash 21696 count 726
hash 21686 count 722
hash 21693 count 709
hash 21689 count 695
hash 21690 count 692
hash 21695 count 686
hash 21697 count 680
hash 21691 count 666
hash 21684 count 653
hash 21687 count 650
hash 21685 count 633
hash 21694 count 607
hash 21692 count 588
hash 21688 count 571
hash 21698 count 541
hash 21683 count 539
hash 21681 count 522
hash 21682 count 520
hash 21680 count 324
hash 21701 count 183
hash 21699 count 41
hash 21343 count 31
hash 21342 count 24
hash 21707 count 22
hash 21346 count 16
hash 21249 count 16
hash 21344 count 14
hash 21315 count 11
all others count 81

The hash table contains 21249 NULLs, then full slots (with a couple
of NULLs near the beginning, but only a few), and from slot 37875
onwards till the end of the hash table there are NULLs again.

Shouldn't we multiply by 2^64 / phi instead of 2^32 / phi when
long is 64-bit?

	Jakub

  parent reply	other threads:[~2004-10-16  9:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14 23:22 Matt Austern
2004-10-14 23:24 ` Phil Edwards
2004-10-15  0:04   ` Matt Austern
2004-10-16 10:17 ` Jakub Jelinek [this message]
2004-10-16 10:37   ` Steven Bosscher
2004-10-17  8:30     ` Mark Mitchell
2004-10-17 10:59       ` Steven Bosscher
2004-10-17 18:45         ` Matt Austern
2004-10-18  4:19         ` Mark Mitchell
2004-10-21 21:25         ` Gerald Pfeifer
2004-10-16 10:42   ` Jakub Jelinek
2004-10-16 11:49     ` Jakub Jelinek
2004-10-16 18:29     ` Matt Austern
2004-10-16 18:35     ` Richard Henderson
2004-10-16 18:37       ` Jakub Jelinek
2004-10-16 18:51         ` Richard Henderson
2004-10-16 19:15           ` Jakub Jelinek
2004-10-17  1:11             ` Richard Henderson
2004-10-16 18:14   ` Matt Austern
2004-10-18 14:48 Richard Kenner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041016094708.GZ31909@devserv.devel.redhat.com \
    --to=jakub@redhat.com \
    --cc=austern@apple.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).