[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 06/12] test-qht: speed up + test qht_resize
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 06/12] test-qht: speed up + test qht_resize |
Date: |
Mon, 10 Sep 2018 14:58:53 -0400 |
Perform first the tests that exercise code paths that are
easier to hit at small table sizes, and then resize the table
to speed up subsequent tests. If this resize is not too large,
we can make the test faster with no code coverage loss.
- With gcov enabled:
Before: 20.568s, 90.28% qht.c coverage
After: 5.168s, 93.06% qht.c coverage
The coverage increase is entirely due to calling qht_resize,
which we weren't calling before. Note that the code paths
that remain to be tested are either error handling or
can only occur when several threads are accessing the
hash table concurrently (e.g. seqlock retry, trylock fail).
- Without gcov:
Before: 1.987s
After: 0.528s
The speedup is almost the same as with gcov, although the
"before" run is a lot faster.
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
tests/test-qht.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/test-qht.c b/tests/test-qht.c
index 77666e8c5f..1ec039d636 100644
--- a/tests/test-qht.c
+++ b/tests/test-qht.c
@@ -189,6 +189,10 @@ static void qht_do_test(unsigned int mode, size_t
init_entries)
rm_nonexist(7, 8);
iter_rm_mod(1);
+ if (!(mode & QHT_MODE_AUTO_RESIZE)) {
+ qht_resize(&ht, init_entries * 4 + 4);
+ }
+
check_n(0);
rm_nonexist(0, 10);
insert(0, N);
--
2.17.1
- [Qemu-devel] [PATCH v2 00/12] qht improvements for 3.1, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 02/12] qht: add qht_iter_remove, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 01/12] qht: remove unused map param from qht_remove__locked, Emilio G. Cota, 2018/09/10
- [Qemu-devel] [PATCH v2 08/12] qht: fix comment in qht_bucket_remove_entry, Emilio G. Cota, 2018/09/10
- [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 <=
- [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