public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Fix bitvector_clear_bits
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <20200106112208.GA22378@delia> (raw)

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

                 reply	other threads:[~2020-01-06 11:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200106112208.GA22378@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).