From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
Fangrui Song <maskray@google.com>
Cc: "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: [PATCH] x86_64: Remove bzero optimization
Date: Mon, 16 May 2022 13:29:31 +0000 [thread overview]
Message-ID: <DB6PR0801MB1879E5C73F658E11E67EA2A883CF9@DB6PR0801MB1879.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <ed13c244-5c0f-aad5-042b-18333182caef@linaro.org>
Hi,
> And also Wilco has suggested that although memset with zero is the most common
> pattern, it is really doubtful that the micro-optimziation is worth on modern
> cores and I agree with him. Not sure how is darwin libc organized and if whether
> its bzero does yield any performance gain, but bug report it seems it was
> aimed to reduce code size.
Yes, about ~90% of memset calls are zero on average. The statistics vary a lot per
application, 50% non-zero and 99% non-zero happen too, so it is not nearly skewed
enough that you only ever do zero memsets in most applications.
And the codesize impact is marginal - in SPEC2017 the benefit would be about 0.05%
on AArch64. These kinds of gains may be worth it in tiny microcontrollers where every
byte counts, but it's a drop in the ocean in big Linux systems.
Cheers,
Wilco
prev parent reply other threads:[~2022-05-16 13:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 12:40 Adhemerval Zanella
2022-05-13 14:54 ` Noah Goldstein
2022-05-13 19:50 ` H.J. Lu
2022-05-13 23:13 ` Noah Goldstein
2022-05-14 0:42 ` H.J. Lu
2022-05-14 23:51 ` Fangrui Song
2022-05-16 12:35 ` Adhemerval Zanella
2022-05-16 13:29 ` Wilco Dijkstra [this message]
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=DB6PR0801MB1879E5C73F658E11E67EA2A883CF9@DB6PR0801MB1879.eurprd08.prod.outlook.com \
--to=wilco.dijkstra@arm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=maskray@google.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).