[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] trunk r115095: Simplify, port and tune bool vector imp
Re: [Emacs-diffs] trunk r115095: Simplify, port and tune bool vector implementation.
Mon, 18 Nov 2013 10:45:55 -0800
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
On 11/17/2013 04:06 AM, Daniel Colascione wrote:
> Can you comment the line you added, though?
Done, in trunk bzr 115139.
> Zero-length bool vectors are _extremely_ uncommon. Please don't
> reduce efficiency in the general case.
Surely any efficiency differences are insignificant here, and it
may well be worth keeping the code simple. However, it's not that
big a deal either way so I changed it back in trunk bzr 115139.
> - changed |= adata[i] ^ mword;
> + if (! changed)
> + changed = adata[i] != mword;
> That's not an optimization.
It was part of an optimization overall, as the surrounding code was changed to
avoid initializing a newly-created bool vector to zeros when it was
going to be immediately overwritten with data, and the above change
was needed to avoid accessing possibly-uninitialized data.
The point is moot now, though, after trunk bzr 115139, where I
optimized away 'changed' entirely.
> We will never run on machines where sizeof(char) == sizeof(int).
True for Emacs's current targets, but when it's easy to write code
portable to those machines (which do exist), we might as well do so,
if only to document what's going on -- sort of the same reason that we
write CHAR_BIT rather than 8.