[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
- [Qemu-devel] [PATCH v2 10/12] qht: constify qht_statistics_init, (continued)
- [Qemu-devel] [PATCH v2 10/12] qht: constify qht_statistics_init, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 04/12] test-qht: test removal of non-existent entries, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 11/12] qht: constify arguments to some internal functions, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 03/12] test-qht: test qht_iter_remove, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 09/12] qht: constify qht_lookup, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 05/12] test-qht: test deletion of the last entry in a bucket, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 06/12] test-qht: speed up + test qht_resize, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 07/12] qht: drop ht argument from qht iterators, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 12/12] qht-bench: add -p flag to precompute hash values, Emilio G. Cota, 2018/09/10
- Re: [Qemu-devel] [PATCH v2 00/12] qht improvements for 3.1, Richard Henderson, 2018/09/12