unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Daniel Colascione <dancol@dancol.org>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] trunk r115095: Simplify, port and tune bool vector implementation.
Date: Mon, 18 Nov 2013 10:45:55 -0800	[thread overview]
Message-ID: <528A6063.3080609@cs.ucla.edu> (raw)
In-Reply-To: <5288B15F.8060102@dancol.org>

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.




  reply	other threads:[~2013-11-18 18:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1VgmqD-0001Ps-LA@vcs.savannah.gnu.org>
2013-11-17 12:06 ` [Emacs-diffs] trunk r115095: Simplify, port and tune bool vector implementation Daniel Colascione
2013-11-18 18:45   ` Paul Eggert [this message]
2013-11-19 18:51     ` Glenn Morris
2013-11-19 21:05       ` Andy Moreton
2013-11-20  1:52         ` Glenn Morris
2013-11-20 13:00           ` Andy Moreton
2013-11-21  6:50       ` [Emacs-diffs] " 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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528A6063.3080609@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=dancol@dancol.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).