public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Wilco Dijkstra" <wdijkstr@arm.com>
To: "'Ondřej Bílka'" <neleai@seznam.cz>
Cc: <libc-alpha@sourceware.org>
Subject: RE: [PATCH][PING] Improve stpncpy performance
Date: Thu, 09 Jul 2015 15:02:00 -0000	[thread overview]
Message-ID: <000c01d0ba58$44d1c170$ce754450$@com> (raw)
In-Reply-To: <20150709110655.GA29253@domone>

> Ondřej Bílka wrote:
>
> You don't have to use special case
> 
> if (size == n)
>   return dest;
> 
> as it should be handled by
> 
> return memset (dest, '\0', 0);
> 
> That could improve performance a bit if its rare case. That doesn't
> matter much as memset makes that function slow and it shouldn't be
> used in performance sensitive code.
> 
> Otherwise ok for me.

On the benchtests the extra if made a significant difference, particularly
since memset of 0 is relatively expensive as it is being regarded as a very
rare case. It seems it should be less likely than the benchtests indicate,
but we'd have to fix the benchtest first to use more realistic data.

Wilco


  reply	other threads:[~2015-07-09 15:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 11:29 Wilco Dijkstra
2015-07-09 13:21 ` Ondřej Bílka
2015-07-09 15:02   ` Wilco Dijkstra [this message]
2015-08-12 20:57     ` Ondřej Bílka
2015-08-19 16:15       ` Wilco Dijkstra

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='000c01d0ba58$44d1c170$ce754450$@com' \
    --to=wdijkstr@arm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=neleai@seznam.cz \
    /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).