qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v2 12/12] qht-bench: add -p flag to precompute hash values
Date: Tue, 11 Sep 2018 21:36:02 -0400	[thread overview]
Message-ID: <20180912013602.GA24650@flamenco> (raw)
In-Reply-To: <8fc81928-961d-7c5b-b34e-38f55d4257af@linaro.org>

On Tue, Sep 11, 2018 at 17:46:41 -0700, Richard Henderson wrote:
> On 09/10/2018 11:58 AM, Emilio G. Cota wrote:
> > @@ -289,7 +297,9 @@ static void htable_init(void)
> >      /* avoid allocating memory later by allocating all the keys now */
> >      keys = g_malloc(sizeof(*keys) * n);
> >      for (i = 0; i < n; i++) {
> > -        keys[i] = populate_offset + i;
> > +        long val = populate_offset + i;
> > +
> > +        keys[i] = precompute_hash ? h(val) : hval(val);
> 
> hfunc?

Here is where precomputation happens, so if precompute_hash is set,
then we insert the hashed value. Otherwise we insert the non-hashed
value (with hval()). In all other instances we use hfunc, since
hfunc is set to the "other" hash function wrt the above--see
this later hunk:

@@ -451,6 +461,10 @@ static void parse_args(int argc, char *argv[])
         case 'o':
             populate_offset = atol(optarg);
             break;
+        case 'p':
+            precompute_hash = true;
+            hfunc = hval;
+            break;

Thanks,

		Emilio

  reply	other threads:[~2018-09-12  1:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 18:58 [Qemu-devel] [PATCH v2 00/12] qht improvements for 3.1 Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 01/12] qht: remove unused map param from qht_remove__locked Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 02/12] qht: add qht_iter_remove Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 03/12] test-qht: test qht_iter_remove Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 04/12] test-qht: test removal of non-existent entries Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 05/12] test-qht: test deletion of the last entry in a bucket Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 06/12] test-qht: speed up + test qht_resize Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 07/12] qht: drop ht argument from qht iterators Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 08/12] qht: fix comment in qht_bucket_remove_entry Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 09/12] qht: constify qht_lookup Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 10/12] qht: constify qht_statistics_init Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 11/12] qht: constify arguments to some internal functions Emilio G. Cota
2018-09-10 18:58 ` [Qemu-devel] [PATCH v2 12/12] qht-bench: add -p flag to precompute hash values Emilio G. Cota
2018-09-12  0:46   ` Richard Henderson
2018-09-12  1:36     ` Emilio G. Cota [this message]
2018-09-12 16:39 ` [Qemu-devel] [PATCH v2 00/12] qht improvements for 3.1 Richard Henderson

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=20180912013602.GA24650@flamenco \
    --to=cota@braap.org \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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 NNTP newsgroup(s).