From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.help Subject: Re: Optimising Elisp code Date: Fri, 5 Oct 2018 06:58:52 -0400 Message-ID: References: <638fb7dc-6fc5-4645-8793-97a00038a3a8@googlegroups.com> <51bfb1a7-71e7-4b9b-8443-4dff9d159189@googlegroups.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1538737048 4009 195.159.176.226 (5 Oct 2018 10:57:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 5 Oct 2018 10:57:28 +0000 (UTC) Cc: Help Gnu Emacs mailing list To: davin.pearson@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 05 12:57:24 2018 Return-path: Envelope-to: geh-help-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 1g8NnN-0000sF-EF for geh-help-gnu-emacs@m.gmane.org; Fri, 05 Oct 2018 12:57:21 +0200 Original-Received: from localhost ([::1]:34502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8NpT-0006p5-Ut for geh-help-gnu-emacs@m.gmane.org; Fri, 05 Oct 2018 06:59:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8Np7-0006ng-PS for help-gnu-emacs@gnu.org; Fri, 05 Oct 2018 06:59:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8Np7-0001XV-3k for help-gnu-emacs@gnu.org; Fri, 05 Oct 2018 06:59:09 -0400 Original-Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:40926) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g8Np6-0001Wg-Tm for help-gnu-emacs@gnu.org; Fri, 05 Oct 2018 06:59:09 -0400 Original-Received: by mail-ot1-x32b.google.com with SMTP id w67so12268982ota.7 for ; Fri, 05 Oct 2018 03:59:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=84UWvplHK1nB4sLQgT+thEZbjrHPv8U0dKPr22Tdc+c=; b=YGAXrezsexYJGXScfRBtuVIIRLEMjp2tKmcnt5h+N30u+E9Xe+3RvP5vMHXKgkz/KW 4X6q9POq6Soy4OjTzlfzaH1d09U5e8FBaXfEkoUyHtEyqVCVeD/F4QjRI5JqCBdWVq2u 4vwhFOB3IarNe2m7RrbUrE9TT/UwuSJTZ01aWLyxyOMjd9Xqlxnq+odMkOm0W7153IjH zi6qsJcyMIP9/w++4kZ4jx5s//MGG2k0BU9i5NBBw8c13iVFgMCU5gQ1Icz3yiddEozN CCP/dL8XUZB8A2KiVavHpAi4PRkFDQwS6PnHKpeEroFVR0ShYKD+18njamMZTvTg62xh 3ukA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=84UWvplHK1nB4sLQgT+thEZbjrHPv8U0dKPr22Tdc+c=; b=i2LcaijDlhRfkrJvfmaEX0P1Wrrw84lS8+Es8ZW1JpWrsjqXvuMkW0S39R1W0Kw1x+ OjzNs3mYzMVLp4+e2zYmaA+lZzu8LCrIXbPELJHFkl2PFYxJBkD5UDO0X8px8RWf3XKm rRPcEMAD2/+6XSon+CjFV02PbY9xpCVVUsh+yR2clLBGAy5iK2JS6ShOFOc1Zfl3aaqV XD2CPEUpYaSoszwqhG8/dZQqP/1PVsqXrqiaCXN+vQo3lsnvyUuwaTqvea3uGaMKcgcE Y5TqALpUOERmOxTiTsQbcjPl8ofs4fUY3+K+UGWR55rtxL/N5q4/5Y6YA4+IKPEfQDHW oMrQ== X-Gm-Message-State: ABuFfohWlBj5rKGdrX7ijO06UQsrCjBQehV8KR9VqjF3g4LFbUcfha6M sUC5SA4w+2IlbJGAE2b0xRVckrevnkdXwp56HtY= X-Google-Smtp-Source: ACcGV62yebwZA6/HtvmFdPnCMy2OqssyT/eU4nYdP2s8NTiS+loUvzHJEooEIJv5ZgFvluLETd77p+gHsKE880M7BFs= X-Received: by 2002:a9d:5ab:: with SMTP id 40-v6mr5885934otd.264.1538737148227; Fri, 05 Oct 2018 03:59:08 -0700 (PDT) In-Reply-To: <51bfb1a7-71e7-4b9b-8443-4dff9d159189@googlegroups.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::32b X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118123 Archived-At: On Thu, 4 Oct 2018 at 22:20, Davin Pearson wrote: > > On Friday, October 5, 2018 at 3:15:32 PM UTC+13, Davin Pearson wrote: > > Suppose that you have a function: > > > > (defun foo () > > (bar)) > > > > And bar is a function that has no side effects and returns 123 then calling > > the function code-optimize (the name of my optimisation routine) > > > > M-x code-optimize on the function foo will result in the following defun > > > > (defun foo () > > 123) > > Please could you admise me about whether or not such as function is part of Gnu Emacs or otherwise available as a third party tool. Not exactly, but if you use defsubst to define bar (defsubst bar () 123), then the result of byte-compiling foo will be equivalent to your optimized version.