qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 12/12] qht-bench: add -p flag to precompute h


From: Emilio G. Cota
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
User-agent: Mutt/1.9.4 (2018-02-28)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]