[Top][All Lists]

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

Re: pure-fns in byte-opt.el

From: Mark Oteiza
Subject: Re: pure-fns in byte-opt.el
Date: Sat, 29 Jul 2017 16:14:12 -0400
User-agent: Mutt/1.8.3 (2017-05-23)

On 29/07/17 at 10:03pm, Andreas Schwab wrote:
On Jul 29 2017, Mark Oteiza <address@hidden> wrote:

On 29/07/17 at 08:22pm, Eli Zaretskii wrote:
From: Mark Oteiza <address@hidden>
Date: Sat, 29 Jul 2017 12:43:51 -0400
Cc: address@hidden

Stefan Monnier <address@hidden> writes:

>> (let ((pure-fns
>> -       '(concat symbol-name regexp-opt regexp-quote string-to-syntax)))
>> +       '(concat symbol-name regexp-opt regexp-quote string-to-syntax
>> +         make-vector)))
> Ah, now that makes a lot more sense: make-vector is much less pure than
> string-to-char.  The above will cause the compiler to replace
>    (make-vector 2 ?a)
> with
>    [?a ?a]
> so you end with a single immediate vector being re-used over and over,
> instead of having a new vector created each time.

But reading a literal vector still generates a new vector, no?

Why do you assume it will be read?

I guess because I don't understand how bytecode is executed.

This has nothing to do with bytecode.  Try this:

(let ((i 0) r)
 (while (< i 2)
   (let ((v (make-vector 2 0)))
     (aset v i i)
     (push v r))
   (setq i (1+ i)))

I see.  Thanks Andreas.

reply via email to

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