public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
To: "tirtajames45@gmail.com" <tirtajames45@gmail.com>
Cc: 'GNU C Library' <libc-alpha@sourceware.org>
Subject: [PATCH] Avoid double bounds check at the start of the loop
Date: Wed, 6 Sep 2023 10:58:26 +0000	[thread overview]
Message-ID: <PAWPR08MB89827CAA9CCE9678CE8E0A5B83EFA@PAWPR08MB8982.eurprd08.prod.outlook.com> (raw)

Hi James,

So the change you're proposing is correct, but did you benchmark it?
The code is written like it is for a good reason: the checks at the start of
the loop avoid one taken branch per loop iteration. So eventhough there
is an unnecessary branch in the very first iteration, performance actually
improves significantly by doing it this way.

Cheers,
Wilco

             reply	other threads:[~2023-09-06 10:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 10:58 Wilco Dijkstra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-09-04 14:56 James Tirta Halim

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=PAWPR08MB89827CAA9CCE9678CE8E0A5B83EFA@PAWPR08MB8982.eurprd08.prod.outlook.com \
    --to=wilco.dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=tirtajames45@gmail.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).