From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.devel Subject: Re: funcall consing Date: Sun, 02 Jan 2022 14:30:38 +0100 Message-ID: <87ee5q5kox.fsf@logand.com> References: <87ee5tm422.fsf@logand.com> <83fsq9gdhw.fsf@gnu.org> <8335m8hazn.fsf@gnu.org> <83pmpbgbmr.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28790"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 02 14:32:33 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 1n40yO-0007I2-D5 for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Jan 2022 14:32:32 +0100 Original-Received: from localhost ([::1]:55324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n40yN-0007hW-7C for ged-emacs-devel@m.gmane-mx.org; Sun, 02 Jan 2022 08:32:31 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58486) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n40we-00069X-Lk for emacs-devel@gnu.org; Sun, 02 Jan 2022 08:30:45 -0500 Original-Received: from logand.com ([37.48.87.44]:53640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n40wc-00067M-Qf; Sun, 02 Jan 2022 08:30:44 -0500 Original-Received: by logand.com (Postfix, from userid 1001) id AC38719EC87; Sun, 2 Jan 2022 14:30:39 +0100 (CET) X-Mailer: emacs 27.2 (via feedmail 11-beta-1 I) In-Reply-To: <83pmpbgbmr.fsf@gnu.org> Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com X-Spam_score_int: 0 X-Spam_score: -0.0 X-Spam_bar: / X-Spam_report: (-0.0 / 5.0 requ) SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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:283906 Archived-At: 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. 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? I do not need absolute numbers, just something so that I can compare two different implementations of the same thing and choose the better one or focus on places to improve.