unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Pip Cet <pipcet@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: master 669aeaf: Prefer make_nil_vector to make-vector with nil
Date: Tue, 11 Aug 2020 17:01:41 -0700	[thread overview]
Message-ID: <670f5411-9c55-5ee4-d27d-5c3df7022d29@cs.ucla.edu> (raw)
In-Reply-To: <CAOqdjBdH8SzCh6MGA2CS6oVLZha_vOjobHDoeouzUTSJf+pTYQ@mail.gmail.com>

On 8/11/20 11:31 AM, Pip Cet wrote:
> How is it faster? It calls allocate_nil_vector, which calls
> allocate_clear_vector.  make_vector also calls allocate_clear_vector.

Oh, you're right, I forgot about the runtime test in make_vector that causes it 
to do what make_nil_vector would do if the initializer is nil.

> I'd say we cut down the complication and use
> Fmake_vector almost everywhere

Although we could simplify somewhat, using Fmake_vector everywhere would go too 
far. It's useful to know one needn't worry about invalid args when calling the 
proper make-vector variant. I found this useful when checking Emacs for 
undefined behavior on integer overflow; for example, 'Fmake_vector (make_fixnum 
(n), ...)' won't do if n is out of range for fixnum. And an uninitialized 
variant is also worthwhile, to avoid initializing vectors twice.



  reply	other threads:[~2020-08-12  0:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200811173009.24292.8963@vcs0.savannah.gnu.org>
     [not found] ` <20200811173011.46A2E20CB8@vcs0.savannah.gnu.org>
2020-08-11 18:31   ` master 669aeaf: Prefer make_nil_vector to make-vector with nil Pip Cet
2020-08-12  0:01     ` Paul Eggert [this message]
2020-08-12 13:05       ` Pip Cet
2020-08-15 18:48         ` Paul Eggert
2020-08-15 19:53           ` Pip Cet

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=670f5411-9c55-5ee4-d27d-5c3df7022d29@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=pipcet@gmail.com \
    /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).