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: Sun, 02 Jan 2022 16:46:02 +0200 Message-ID: <838rvydwlx.fsf@gnu.org> References: <87ee5tm422.fsf@logand.com> <83fsq9gdhw.fsf@gnu.org> <8335m8hazn.fsf@gnu.org> <83pmpbgbmr.fsf@gnu.org> <87ee5q5kox.fsf@logand.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10458"; 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 Sun Jan 02 15:46:48 2022 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 1n428G-0002Wq-Gd for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Jan 2022 15:46:48 +0100 Original-Received: from localhost ([::1]:50770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n428E-0003bK-My for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Jan 2022 09:46:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n427V-0002rj-By for emacs-devel@gnu.org; Sun, 02 Jan 2022 09:46:01 -0500 Original-Received: from [2001:470:142:3::e] (port=56036 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 1n427T-0007Xy-FT; Sun, 02 Jan 2022 09:46:00 -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=4iccxODkKZ+OedbrELAaTIiyqUmjGaDJGiN/HC8SNlw=; b=eLY4YjLOBSIO GIZsN3Eq/SQj0L7DOQ25BLQW9oU6oJoWIWe/J6pPp9I08pgBZcFXbZJytC9P18/0cam0wB34X56t4 HMNF2HVzCDtTmDe55u8CoedG5A8vABJs5NIl6eRb1HbkR5XKLEWCA5GnL4hVe+q5MU3YZVyul47BW pkWDGQdtfq38iSsEWDr7deDb86z7DLJKIdNnvNNxtPvfPCbdcmTVRzK0M5VcABmPagsN2sQWWW+dV 5dXmP3/V+Lj8nlClGO13zS6KdPPbmEiGbncbfdH5F/7/y9jFNxolmO7jeNrgrz6p1P6+11QMR2N0U 6jFizUi6DfHPXl0ALkaXkQ==; Original-Received: from [87.69.77.57] (port=3712 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 1n427T-0005fp-FF; Sun, 02 Jan 2022 09:45:59 -0500 In-Reply-To: <87ee5q5kox.fsf@logand.com> (message from Tomas Hlavaty on Sun, 02 Jan 2022 14:30:38 +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:283912 Archived-At: > From: Tomas Hlavaty > Cc: emacs-devel@gnu.org > Date: Sun, 02 Jan 2022 14:30:38 +0100 > > On Sat 01 Jan 2022 at 09:26, Eli Zaretskii wrote: > > Note that one of the examples posted by the OP does exactly twice GC > > cycles that the other. Which leads me to believe it had twice more > > opportunities for checking how much consing was done. > > > > So I think the caveat not to put too much faith in the _number_ of GC > > cycles is still something important to keep in mind. > > In my example: > > (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) > > the third number is the time taken by garbage collection. It is also > roughly doubled for the second case indicating that the second case > really generated more (say about twice as much) garbage. The longer time taken by GC doesn't necessarily mean more garbage was collected. Scanning the same number of Lisp objects twice the number of times will take roughly twice the time. > Otherwise benchmark-run is not really useful for what I need. In that > case, what is the preferred way to measure execution speed and consing? My suggestion is to examine and analyze the output of garbage-collect. There are also the various *-cells-consed variables you could use.