From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: Re: pure-fns in byte-opt.el Date: Sat, 29 Jul 2017 16:14:12 -0400 Message-ID: <20170729201412.GA17809@holos.localdomain> 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> <87shhfxb6d.fsf@linux-m68k.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Trace: blaine.gmane.org 1501359269 19348 195.159.176.226 (29 Jul 2017 20:14:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Jul 2017 20:14:29 +0000 (UTC) User-Agent: Mutt/1.8.3 (2017-05-23) Cc: Eli Zaretskii , monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 29 22:14:23 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 1dbY7y-0004en-AK for ged-emacs-devel@m.gmane.org; Sat, 29 Jul 2017 22:14:22 +0200 Original-Received: from localhost ([::1]:53300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbY80-0008VZ-Mg for ged-emacs-devel@m.gmane.org; Sat, 29 Jul 2017 16:14:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dbY7u-0008VT-GE for emacs-devel@gnu.org; Sat, 29 Jul 2017 16:14:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dbY7r-0003v5-CD for emacs-devel@gnu.org; Sat, 29 Jul 2017 16:14:18 -0400 Original-Received: from mail-qk0-x233.google.com ([2607:f8b0:400d:c09::233]:38617) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dbY7r-0003uI-4y for emacs-devel@gnu.org; Sat, 29 Jul 2017 16:14:15 -0400 Original-Received: by mail-qk0-x233.google.com with SMTP id x191so66622872qka.5 for ; Sat, 29 Jul 2017 13:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CA7c+FxXYrcUWrDYQPMKYYM5yjhDtdfprjm/GELBXyY=; b=XhkV//0q9UvJ6YgDCqbdPsFndlzIklAPySSyMZsqGHY8W1Yi32HskQim4/91XXpz6l y++eQQkzG0xFklg91jAt/h7BajlkR6CusQTq77UJzBR6HOIw6mXwHR8GV8B2rb9puoaw Qgy9roiSf2dhOCm3RyYmOPutjor9a+4dpMt8Qie7aBrPui97H/KJisfZlBEkTJ8/Igax Lf9DVVct2zQ9msEu/eIx2ZGUJiSiI4BtzseqlHzQiDZby1NDRX/9KGDyykhE6PJUkulp knW/aje9Zr1kMnHcdT6hk1fl2HOlcd7mof5ud+HxRUMMxalIvSNDu+4IYZuXPS+8xsGh CrFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CA7c+FxXYrcUWrDYQPMKYYM5yjhDtdfprjm/GELBXyY=; b=lORDnxMKmxNU8Zf1XNONx49UHMUa0x27jEvESq/2q3/RLlUNrFU6t3aIsybiHyIyuU ALPVE/Q4wmPoflHtvhhie5DCMnj+Avr3ec2DEa+RgWY4pd0HRlXwD8Boqj2d/u9J3Pf8 9/jusa5xl/+y35u7l3PS9+QMlMCTWZ8jiPT0EGTEW330kyn8aZqFwgLaXc3nKa/la7i/ JR1nAouA4aKlwiEsf7NsdXeApftv/yw5ipWUVfmWt6ZcSusBnJI/y5HenD82QMJuUZR5 d8mazhcZPJag+qibYwsIzJi//26wmAJheSHx9AFX06tfhd4niwe6HoE+TqUFZS8ZUczL q92A== X-Gm-Message-State: AIVw112t25Zrn+xiLKnDSiBw7efoDPqIgw429FiAuPTjWNTkqaGc66AJ rs8LMxu4FCSulZoq X-Received: by 10.55.21.28 with SMTP id f28mr14312923qkh.220.1501359254332; Sat, 29 Jul 2017 13:14:14 -0700 (PDT) Original-Received: from holos.localdomain (pool-173-64-125-158.bltmmd.fios.verizon.net. [173.64.125.158]) by smtp.gmail.com with ESMTPSA id m64sm8546991qte.53.2017.07.29.13.14.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 29 Jul 2017 13:14:13 -0700 (PDT) Original-Received: by holos.localdomain (Postfix, from userid 1000) id 1125568E56; Sat, 29 Jul 2017 16:14:13 -0400 (EDT) Content-Disposition: inline In-Reply-To: <87shhfxb6d.fsf@linux-m68k.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::233 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:217150 Archived-At: On 29/07/17 at 10:03pm, Andreas Schwab wrote: >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) I see. Thanks Andreas.