From: John Wiegley <jwiegley@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Paul Eggert <eggert@cs.ucla.edu>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 605f901: Prefer memcpy and memset to doing it by hand
Date: Sun, 07 Feb 2016 12:53:29 -0500 [thread overview]
Message-ID: <m237t4quee.fsf@newartisans.com> (raw)
In-Reply-To: <jwv1t8rtho0.fsf-monnier+emacsdiffs@gnu.org> (Stefan Monnier's message of "Fri, 05 Feb 2016 08:25:11 -0500")
>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> + if (XLI (init) == 0)
>> + memset (p->contents, 0, XFASTINT (length) * sizeof p->contents[0]);
>> + else
>> + for (ptrdiff_t i = 0; i < XFASTINT (length); i++)
>> + p->contents[i] = init;
> FWIW, I much prefer keeping just the loop, over using this "if+memset" which
> seems like an obvious case or too-early-optimization.
Is this so performance critical that we can't just always use the memset?
Don't modern compilers inline the memset into the loop these days?
--
John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
next prev parent reply other threads:[~2016-02-07 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160205003917.14369.86929@vcs.savannah.gnu.org>
[not found] ` <E1aRUQf-0003kP-6V@vcs.savannah.gnu.org>
2016-02-05 13:25 ` [Emacs-diffs] master 605f901: Prefer memcpy and memset to doing it by hand Stefan Monnier
2016-02-05 22:40 ` Paul Eggert
2016-02-07 17:53 ` John Wiegley [this message]
2016-02-07 21:24 ` Paul Eggert
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=m237t4quee.fsf@newartisans.com \
--to=jwiegley@gmail.com \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=johnw@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.