all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Mark Oteiza <mvoteiza@udel.edu>
Cc: Eli Zaretskii <eliz@gnu.org>,
	monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: pure-fns in byte-opt.el
Date: Sat, 29 Jul 2017 22:03:54 +0200	[thread overview]
Message-ID: <87shhfxb6d.fsf@linux-m68k.org> (raw)
In-Reply-To: <20170729194858.GA14205@holos.localdomain> (Mark Oteiza's message of "Sat, 29 Jul 2017 15:48:58 -0400")

On Jul 29 2017, Mark Oteiza <mvoteiza@udel.edu> wrote:

> On 29/07/17 at 08:22pm, Eli Zaretskii wrote:
>>> From: Mark Oteiza <mvoteiza@udel.edu>
>>> Date: Sat, 29 Jul 2017 12:43:51 -0400
>>> Cc: emacs-devel@gnu.org
>>>
>>> Stefan Monnier <monnier@iro.umontreal.ca> 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)))
  r)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



  reply	other threads:[~2017-07-29 20:03 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25  2:06 pure-fns in byte-opt.el Mark Oteiza
2017-07-25  8:14 ` Andreas Schwab
2017-07-25 14:16   ` Stefan Monnier
2017-07-25 20:57     ` Philipp Stephani
2017-07-25 21:27       ` Stefan Monnier
2017-07-25 22:28         ` Clément Pit-Claudel
2017-07-26  0:08           ` Stefan Monnier
2017-07-26  7:39             ` Clément Pit-Claudel
2017-07-26 12:58               ` Stefan Monnier
2017-07-28 17:45         ` Philipp Stephani
2017-07-28 17:49           ` Stefan Monnier
2017-07-28 17:52             ` Philipp Stephani
2017-07-28 22:20               ` Stefan Monnier
2017-09-24  7:31                 ` Philipp Stephani
2017-09-24 16:23                   ` Stefan Monnier
2017-09-25 22:06                     ` Richard Stallman
2017-09-26  0:25                       ` Stefan Monnier
2020-07-25 19:53                         ` Philipp Stephani
2020-07-25 19:58                           ` Stefan Monnier
2020-07-25 20:08                             ` Philipp Stephani
2020-07-25 20:59                               ` Stefan Monnier
2020-07-29 14:21                                 ` Philipp Stephani
2020-07-29 14:25                                   ` Stefan Monnier
2017-09-24 16:26                   ` Drew Adams
2017-07-26  1:00   ` Mark Oteiza
2017-07-26 14:33     ` Eli Zaretskii
2017-07-27  2:36       ` Mark Oteiza
2017-07-27  2:46         ` Stefan Monnier
2017-07-29 16:43           ` Mark Oteiza
2017-07-29 17:22             ` Eli Zaretskii
2017-07-29 19:48               ` Mark Oteiza
2017-07-29 20:03                 ` Andreas Schwab [this message]
2017-07-29 20:14                   ` Mark Oteiza
2017-07-27 17:06         ` Eli Zaretskii
2017-07-28  0:24           ` Mark Oteiza
2017-07-28  7:02             ` Eli Zaretskii
2017-07-29  1:24               ` Mark Oteiza
2017-07-29  7:24                 ` Eli Zaretskii
2017-07-29 16:34                   ` Mark Oteiza
2017-07-29 17:21                     ` Eli Zaretskii
2017-09-24  7:34                       ` Philipp Stephani
2017-09-24 16:24                         ` Stefan Monnier
2017-09-24 23:22                         ` John Wiegley

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

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

  git send-email \
    --in-reply-to=87shhfxb6d.fsf@linux-m68k.org \
    --to=schwab@linux-m68k.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=mvoteiza@udel.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.