public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Michael Meeks <michael.meeks@novell.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: binutils@sources.redhat.com,
	djamel anonymous <djam8193ah@hotmail.com>,
	 Ulrich Drepper <drepper@redhat.com>,
	libc-alpha@sources.redhat.com
Subject: Re: DT_GNU_HASH latest patches
Date: Fri, 07 Jul 2006 10:07:00 -0000	[thread overview]
Message-ID: <1152267026.13278.83.camel@t60p.site> (raw)
In-Reply-To: <20060706182116.GM3823@sunsite.mff.cuni.cz>

Hi Jakub,

On Thu, 2006-07-06 at 20:21 +0200, Jakub Jelinek wrote:
> 1) swapped chainoff and bitmask in the buckets array pairs - bitmask
>    is accessed first by ld.so, so it makes sense to put it first

	So - it took a little while to understand your patch :-) from what I
see; we insert a 32bit bitmask into the buckets ( in addition to the
offset ) whose purpose is to reduce the number of L2 misses incurred by
lookups in the 'chain' by seeing if a given bit is set in that mask.

	Each chain element sets a mask bit using bits 6-10 of the hash as an
integer offset / bit-mask (0-31 bits), that is then compared at lookup.

	So - I guess that's an interesting new twist ;-) I'm not entirely sold
on it at 1st glance since it makes the working set larger and the access
pattern less predictable - but, if the numbers show it working nicely
that's great :-) - [ I found them slightly hard to read side-by-side ].

	Some misc. other code questions:

+	  if (buckets[0] & new_hash_bit)

	Since the average chain length is ~2.5 (say 3) entries; and we have 32
bits to play with here, assuming bits 6-10 are as random as we would
like, there is a P(1/10) here that this branch is taken - should we have
a __builtin_expect reflecting that ?

	Similarly is it worth moving some more of the symtab/strtab
construction out of the hot path ?, but perhaps the compiler will do it:

		if ((*hasharr & ~1u) == (new_hash & ~1u))
		  {
		    symidx = hasharr - map->l_gnu_chain_zero;
+                   /* The tables for this map.  */
+                   const ElfW(Sym) *symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
+                   const char *strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+                   const ElfW(Half) *verstab = map->l_versyms;
		    sym = check_match (&symtab[symidx]);
		    if (sym != NULL)
		      goto found_it;
		  }

	[ and the same ? for the old style case, AFAIR - I did this in the
dynhash patch of old ]

	Similarly - [ and I've no idea how these 'expect' markups really help
on various arches (as no doubt you've guessed by now ;-) ] this is
presumably a rather uncommon case:

+      /* If the hash table is empty there is nothing to do here.  */
+      if (map->l_nbuckets == 0)
+	continue;

	I guess now the common case in this loop is hitting buckets[0] &
new_hash_bit and looping, is there anything else we can remove / defer /
annotate in that (now much hotter) loop.

	Otherwise - this looks really interesting to me :-)

	Thanks,

		Michael.

-- 
 michael.meeks@novell.com  <><, Pseudo Engineer, itinerant idiot


  parent reply	other threads:[~2006-07-07 10:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <44A9D4EB.2040107@redhat.com>
     [not found] ` <BAY22-F13B0B8E34EA055F9BF6E50C7710@phx.gbl>
     [not found]   ` <20060705090438.GJ3823@sunsite.mff.cuni.cz>
2006-07-06 11:26     ` DT_GNU_HASH benchmark results Jakub Jelinek
2006-07-06 18:22       ` DT_GNU_HASH latest patches Jakub Jelinek
2006-07-06 19:53         ` djamel anonymous
2006-07-07 14:45           ` Jakub Jelinek
2006-07-07 15:57             ` djamel anonymous
2006-07-09 22:27               ` Jakub Jelinek
2006-07-08  2:45             ` Eric Christopher
2006-07-09 22:35               ` Jakub Jelinek
2006-07-10 14:18             ` Nick Clifton
2006-07-10 14:18             ` Nick Clifton
2006-07-10 14:20             ` Nick Clifton
2006-07-10 21:52               ` Jakub Jelinek
2006-07-11 13:35                 ` Hans-Peter Nilsson
2006-07-11 13:58                   ` Jakub Jelinek
2006-07-07 10:07         ` Michael Meeks [this message]
2006-07-07 13:43           ` Ulrich Drepper
2006-07-07 13:49           ` Jakub Jelinek

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=1152267026.13278.83.camel@t60p.site \
    --to=michael.meeks@novell.com \
    --cc=binutils@sources.redhat.com \
    --cc=djam8193ah@hotmail.com \
    --cc=drepper@redhat.com \
    --cc=jakub@redhat.com \
    --cc=libc-alpha@sources.redhat.com \
    /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).