From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [patch] generator function optimizations Date: Sun, 12 Mar 2017 13:21:06 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489339300 19133 195.159.176.226 (12 Mar 2017 17:21:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 12 Mar 2017 17:21:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 12 18:21:36 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 1cn7BR-0003sf-EP for ged-emacs-devel@m.gmane.org; Sun, 12 Mar 2017 18:21:29 +0100 Original-Received: from localhost ([::1]:47743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cn7BX-0001b8-6A for ged-emacs-devel@m.gmane.org; Sun, 12 Mar 2017 13:21:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46006) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cn7BP-0001b1-3K for emacs-devel@gnu.org; Sun, 12 Mar 2017 13:21:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cn7BK-0000qO-5s for emacs-devel@gnu.org; Sun, 12 Mar 2017 13:21:27 -0400 Original-Received: from [195.159.176.226] (port=34614 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cn7BJ-0000qB-Vk for emacs-devel@gnu.org; Sun, 12 Mar 2017 13:21:22 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cn7B8-0001vk-Bt for emacs-devel@gnu.org; Sun, 12 Mar 2017 18:21:10 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 26 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:25WE//ZblD+EesJRX7nJBDynH0c= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:212952 Archived-At: > In my real code (a very large function used as a co-routine) > with 60 yields, generator function has over 1000 lambdas. > I see several ways to improve this at least somewhat. > > The patch below improves transformation of `progn' forms. > Here it results in 30 lambdas in the generator function fewer. > Not great (~ -3%), but I guess in other cases it can give a > larger improvement. Hmm... I don't think anyone should really care about the number of lambdas, right? So what is the actual problem (caused by this large number of lambdas) that you're trying to improve? Code size? Run time? Both? Something else? Have you tried to measure the impact of your patch on the actual problem? > If this patch is accepted, I can work on some other ideas > I have. Indeed, there's probably a lot of opportunity for improvement. E.g. cconv.el was designed based on the assumption that there wouldn't be many different lambdas within the same scope (i.e. we don't try to share the data part of various related closures). Stefan