From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: pure-fns in byte-opt.el Date: Sat, 29 Jul 2017 22:03:54 +0200 Message-ID: <87shhfxb6d.fsf@linux-m68k.org> References: <20170725020650.GA12601@holos.localdomain> <20170726010000.GA14292@holos.localdomain> <83o9s75kus.fsf@gnu.org> <20170727023608.GA1895@holos.localdomain> <87zibnuraw.fsf@holos> <838tj72m5b.fsf@gnu.org> <20170729194858.GA14205@holos.localdomain> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1501358657 30789 195.159.176.226 (29 Jul 2017 20:04:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Jul 2017 20:04:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: Eli Zaretskii , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Mark Oteiza Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 29 22:04:09 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbXy1-0007Ru-Of for ged-emacs-devel@m.gmane.org; Sat, 29 Jul 2017 22:04:05 +0200 Original-Received: from localhost ([::1]:53283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbXy7-0003Kx-JF for ged-emacs-devel@m.gmane.org; Sat, 29 Jul 2017 16:04:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbXy1-0003CK-4d for emacs-devel@gnu.org; Sat, 29 Jul 2017 16:04:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbXxz-0005UI-UL for emacs-devel@gnu.org; Sat, 29 Jul 2017 16:04:05 -0400 Original-Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:40077) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dbXxw-0005Q7-2X; Sat, 29 Jul 2017 16:04:00 -0400 Original-Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3xKc9S6qPPz1qrdw; Sat, 29 Jul 2017 22:03:56 +0200 (CEST) Original-Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3xKc9S4kPgz3jgY2; Sat, 29 Jul 2017 22:03:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Original-Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id t6DA82eaLwx8; Sat, 29 Jul 2017 22:03:55 +0200 (CEST) X-Auth-Info: sVhdvj0VUQzER5UvCFvoXwGnc3lxeW+QKK11pD3ob7BNQ2FDUTl5mbsgUo3VHFBQ Original-Received: from igel.home (ppp-88-217-6-174.dynamic.mnet-online.de [88.217.6.174]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sat, 29 Jul 2017 22:03:54 +0200 (CEST) Original-Received: by igel.home (Postfix, from userid 1000) id 560A32C3386; Sat, 29 Jul 2017 22:03:54 +0200 (CEST) X-Yow: Are you selling NYLON OIL WELLS?? If so, we can use TWO DOZEN!! In-Reply-To: <20170729194858.GA14205@holos.localdomain> (Mark Oteiza's message of "Sat, 29 Jul 2017 15:48:58 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:a60:0:28:0:1:25:1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217148 Archived-At: On Jul 29 2017, Mark Oteiza wrote: > On 29/07/17 at 08:22pm, Eli Zaretskii wrote: >>> From: Mark Oteiza >>> Date: Sat, 29 Jul 2017 12:43:51 -0400 >>> Cc: emacs-devel@gnu.org >>> >>> Stefan Monnier 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."