From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#29866: 27.0.50; cl-loop: Calculate the array length just once Date: Thu, 28 Dec 2017 01:10:29 +0900 Message-ID: <87wp18179m.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1514390966 6727 195.159.176.226 (27 Dec 2017 16:09:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 27 Dec 2017 16:09:26 +0000 (UTC) Cc: monnier@iro.umontreal.ca To: 29866@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 27 17:09:22 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1eUEGc-0001G8-Mt for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Dec 2017 17:09:18 +0100 Original-Received: from localhost ([::1]:38148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUEIb-0003aK-DB for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Dec 2017 11:11:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUEIN-0003YL-9e for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2017 11:11:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUEIK-0005zC-7A for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2017 11:11:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eUEIJ-0005yv-Tp for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2017 11:11:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eUEII-0007ks-Er; Wed, 27 Dec 2017 11:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: monnier@iro.umontreal.ca, bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Dec 2017 16:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29866 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: monnier@iro.umontreal.ca Original-Received: via spool by submit@debbugs.gnu.org id=B.151439105429787 (code B ref -1); Wed, 27 Dec 2017 16:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Dec 2017 16:10:54 +0000 Original-Received: from localhost ([127.0.0.1]:54038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUEI9-0007kN-TS for submit@debbugs.gnu.org; Wed, 27 Dec 2017 11:10:54 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUEI5-0007k7-Iu for submit@debbugs.gnu.org; Wed, 27 Dec 2017 11:10:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUEHz-0005SC-11 for submit@debbugs.gnu.org; Wed, 27 Dec 2017 11:10:44 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47135) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eUEHy-0005Rn-RZ for submit@debbugs.gnu.org; Wed, 27 Dec 2017 11:10:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUEHx-0003OJ-Kq for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2017 11:10:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUEHu-0005M2-AQ for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2017 11:10:41 -0500 Original-Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:39513) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eUEHs-0005IR-Gg for bug-gnu-emacs@gnu.org; Wed, 27 Dec 2017 11:10:37 -0500 Original-Received: by mail-wr0-x232.google.com with SMTP id o101so8439334wrb.6 for ; Wed, 27 Dec 2017 08:10:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=9wRffDGElLbIqKpfCXc37HQ7J6cT0vdMeTlxIzydQcc=; b=i06c3sIFmp4V7ZnPOLU+li/BNUgldUZlIPIIAw4eJuHdcCOdKNap6gECzb6VwwGcmz mR/lCQ/uEwKsaBUF/1wIfrjxErjJUmMeuwLn+5J6qHheOQJjQPuQV2xnhfG2cPI8ZvB6 6BNxI5mna7fVC4jfViq6qyPJrqlpDgMwDpLi4gSi7ZM8UZbIgmTTBVmVeyiVjuEROrze 7uY1h2YfGhBeRsoQw7OsXW7ikCDNGvy4PfC7jGBZ8TtvpEL4MkszdpDFzYrdmXXQBcx3 H71q31ehL7hv4c1I6eD6i0wLNi+IZzkGpkBNoCrnXnRmxmGYV604w/yYVfFIgPlwh5dc rg0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=9wRffDGElLbIqKpfCXc37HQ7J6cT0vdMeTlxIzydQcc=; b=hmQkXqLCgfKb/+7PQrPJyilPkfM4NBhi5IhGhAxQbYZYSH58CtpEAujShVZ8632vaK gcDqPKgpi5brSYdnvJRfDlFGor5QdP0kgrJxAgiPR9AfKp2el+S00pN1Xb6ktI0qzlhG 37Uv0qUpwwDubWGZs5PaLfDRswodNnDzsDxv6Y6aFGbeiBUGpufEPVPQvo0GwajInDnm jVEAs73QdG8AL45t5nHHJxV2HeNDsRDkLm4Kew+GaXA2eDg36c7Z1ia6YiFxGEEKlnYL JQnTi0gJ1qeDBQH+4F3JTA8V05cGzAuFeNQPmrT1cdof/S6ljl8H5I19wcJZip1UC0/X b0vA== X-Gm-Message-State: AKGB3mJclmeFMSVHOMcZiltpBHxnprNj0hsdFnWTXrMnhXU6Mdog5kHx xERcdEH9IwhIj+VpygKIUejKAg== X-Google-Smtp-Source: ACJfBov8oH+9493hOY/rzS2jipg8wJ4FYDZ0xincb2gcvGE62SiJtAUfA0BbeYOyw2MaAbonyzB9xw== X-Received: by 10.223.132.35 with SMTP id 32mr30864159wrf.248.1514391034825; Wed, 27 Dec 2017 08:10:34 -0800 (PST) Original-Received: from calancha-pc (228.red-83-40-68.dynamicip.rima-tde.net. [83.40.68.228]) by smtp.gmail.com with ESMTPSA id p132sm42266665wmb.0.2017.12.27.08.10.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Dec 2017 08:10:34 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141532 Archived-At: X-Debbugs-CC: monnier@iro.umontreal.ca It looks sensible to calculate the array length just once, instead of recalculate it on each iteration: --8<-----------------------------cut here---------------start------------->8--- commit 1175db5cf09eb39e7e70703f38578d31b0dd9398 Author: Tino Calancha Date: Thu Dec 28 00:56:32 2017 +0900 cl-loop: Calculate the array length just once * lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): Dont calculate the array length on each iteration (Bug#29866). diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index f5311041cc..f671aea399 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -1317,11 +1317,13 @@ cl--parse-loop-clause ((memq word '(across across-ref)) (let ((temp-vec (make-symbol "--cl-vec--")) + (temp-len (make-symbol "--cl-len--")) (temp-idx (make-symbol "--cl-idx--"))) (push (list temp-vec (pop cl--loop-args)) loop-for-bindings) + (push (list temp-len `(length ,temp-vec)) loop-for-bindings) (push (list temp-idx -1) loop-for-bindings) (push `(< (setq ,temp-idx (1+ ,temp-idx)) - (length ,temp-vec)) + ,temp-len) cl--loop-body) (if (eq word 'across-ref) (push (list var `(aref ,temp-vec ,temp-idx)) --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 27.0.50 (build 32, x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-12-28 built on calancha-pc Repository revision: da94ea92bc3ba6c236b394c00e6bbb725131a149 Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 System Description: Debian GNU/Linux 9.3 (stretch)