public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Fix bitvector_clear_bits
@ 2020-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

The commit 94e7891 "Reimplement seen flag of struct import_cu as bitvector"
introduces the function bitvector_clear_bits.

This function calculates the start element to be cleared, and the number of
elements, but then proceeds to use the number of elements as number of bytes
argument to the memset call.

Fix this by converting the memset argument from number of elements into number
of bytes.

This brings the improvement by the mentioned commit of 15% on vmlinux down
to 4%:
...
real:  mean:  16684.40 100.00%  stddev:  219.82
       mean:  15962.80  95.68%  stddev:  161.35
user:  mean:  16239.40 100.00%  stddev:   93.90
       mean:  15556.00  95.79%  stddev:  155.83
sys:   mean:    326.40 100.00%  stddev:   21.09
       mean:    313.60  96.08%  stddev:   33.66
...

Committed to trunk.

Thanks,
- Tom

Fix bitvector_clear_bits

2020-01-06  Tom de Vries  <tdevries@suse.de>

	* dwz.c (bitvector_clear_bits): Fix cleared range.

---
 dwz.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dwz.c b/dwz.c
index 2f1f59f..33aea2a 100644
--- a/dwz.c
+++ b/dwz.c
@@ -6890,7 +6890,8 @@ bitvector_clear_bits (BITVECTOR_TYPE *vector, unsigned int a, unsigned int b)
 {
   unsigned int range_min = a / (sizeof (BITVECTOR_TYPE) * 8);
   unsigned int range_max = b / (sizeof (BITVECTOR_TYPE) * 8);
-  memset (&vector[range_min], 0, range_max - range_min + 1);
+  memset (&vector[range_min], 0,
+	  (range_max - range_min + 1) * sizeof (BITVECTOR_TYPE));
 }
 
 /* Function to optimize the size of DW_TAG_imported_unit DIEs by

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-06 11:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01  0:00 [committed] Fix bitvector_clear_bits Tom de Vries

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).