emacs-devel
[Top][All Lists]
Advanced

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

Re: master 669aeaf: Prefer make_nil_vector to make-vector with nil


From: Paul Eggert
Subject: Re: master 669aeaf: Prefer make_nil_vector to make-vector with nil
Date: Tue, 11 Aug 2020 17:01:41 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

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 via email to

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