From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: funcall consing Date: Fri, 31 Dec 2021 14:33:47 +0200 Message-ID: <83fsq9gdhw.fsf@gnu.org> References: <87ee5tm422.fsf@logand.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13893"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Tomas Hlavaty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 31 13:34:39 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n3H7G-0003NE-J3 for ged-emacs-devel@m.gmane-mx.org; Fri, 31 Dec 2021 13:34:38 +0100 Original-Received: from localhost ([::1]:39258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n3H7F-00031s-Du for ged-emacs-devel@m.gmane-mx.org; Fri, 31 Dec 2021 07:34:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3H6K-00011C-1p for emacs-devel@gnu.org; Fri, 31 Dec 2021 07:33:40 -0500 Original-Received: from [2001:470:142:3::e] (port=37846 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3H6J-0007Gu-GD; Fri, 31 Dec 2021 07:33:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GqRWvuT7NrO94Cgi/UUV7fNEVhBObiz9DoZs6b/vvE4=; b=Lt4Ze2ViZ6t/ zmrTLVSk+Y6+IVLp46aK1kqvRitnlmS/JWFcWJ+9z9YTmXq05fogv7v2YCvGT1C9dcvq2r6JHw9FC eNn9lo3O9z+YYVAq2vSE45tz9MdP6kYKOC31N1a9Pzf3B0ILls/lVoMK9dOje1CYMIOcBSSMUrBaz iM+9SI43zB8gRydySHcs9oGODE09iXowal0X6muArN0vN15P5bVR8R+yCDJcrIAU+Q2c9ZjD7kT1x bjA79WQtTLUNYeGWwLthKV/RNdLtP/clUTrJ7yHF27s5DeKW3Cri6KVpjZSRwnwtxdoCzOzk2/8ZX OjGD+1SKSyFxVQSge/yvqw==; Original-Received: from [87.69.77.57] (port=3732 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n3H6J-0007Kz-EG; Fri, 31 Dec 2021 07:33:39 -0500 In-Reply-To: <87ee5tm422.fsf@logand.com> (message from Tomas Hlavaty on Fri, 31 Dec 2021 12:01:09 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:283738 Archived-At: > From: Tomas Hlavaty > Date: Fri, 31 Dec 2021 12:01:09 +0100 > > in order to optimize some elisp code, I am trying to understand where my > consing comes from. So far it looks like that my assumption about the > cause of consing are wrong and that the cause of consing is funcall. Is > that plausible? I am seeing similar results like this (lexical-binding, > also byte compiled): > > (benchmark-run 10 (dotimes (i 100000) (1+ i))) > ;;(2.720941123 40 1.7525918699999998) > (let ((x (lambda (i) (1+ i)))) (benchmark-run 10 (dotimes (i 100000) (funcall x i)))) > ;;(4.9373091140000005 80 3.4835688719999958) > > i.e. funcall conses a lot and introduces cca double performance penalty. What do you mean by "consing" in this context, and what is your evidence for "consing" in the above example? Is that only the performance degradation, or is that something else?