emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 605f901: Prefer memcpy and memset to doing it b


From: John Wiegley
Subject: Re: [Emacs-diffs] master 605f901: Prefer memcpy and memset to doing it by hand
Date: Sun, 07 Feb 2016 12:53:29 -0500
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/24.5 (darwin)

>>>>> Stefan Monnier <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]