From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: marking overhead, and on the cost of conditionals in hot code Date: Fri, 16 Jan 2009 23:00:17 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1232148713 11051 80.91.229.12 (16 Jan 2009 23:31:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Jan 2009 23:31:53 +0000 (UTC) To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 17 00:33:03 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LNyBA-00070m-An for guile-devel@m.gmane.org; Sat, 17 Jan 2009 00:32:44 +0100 Original-Received: from localhost ([127.0.0.1]:51321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNy9t-0003KT-BV for guile-devel@m.gmane.org; Fri, 16 Jan 2009 18:31:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNy9q-0003KN-7N for guile-devel@gnu.org; Fri, 16 Jan 2009 18:31:22 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNy9n-0003KB-R8 for guile-devel@gnu.org; Fri, 16 Jan 2009 18:31:20 -0500 Original-Received: from [199.232.76.173] (port=46881 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNy9n-0003K8-Jv for guile-devel@gnu.org; Fri, 16 Jan 2009 18:31:19 -0500 Original-Received: from a-sasl-quonix.sasl.smtp.pobox.com ([208.72.237.25]:62457 helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LNy9n-0000Fj-D0 for guile-devel@gnu.org; Fri, 16 Jan 2009 18:31:19 -0500 Original-Received: from localhost.localdomain (unknown [127.0.0.1]) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 0135C1C98A for ; Fri, 16 Jan 2009 18:31:17 -0500 (EST) Original-Received: from unquote (unknown [83.44.191.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 74E771C989 for ; Fri, 16 Jan 2009 18:31:15 -0500 (EST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-Pobox-Relay-ID: C5878E04-E425-11DD-BBD4-2E3B113D384A-02397024!a-sasl-quonix.pobox.com X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8045 Archived-At: I dropped into cachegrind, and it tells me thing about scm_gc_mark in a simple guile -c 1 run: . void . scm_gc_mark (SCM ptr) 794,344 { 155,170 => ???:0x00024917 (77585x) 198,586 if (SCM_IMP (ptr)) . return; . 513,038 if (SCM_GC_MARK_P (ptr)) . return; . 84,580 if (!scm_i_marking) . { . static const char msg[] . = "Should only call scm_gc_mark() during GC."; . scm_c_issue_deprecation_warning (msg); . } . 42,290 SCM_SET_GC_MARK (ptr); 63,435 scm_gc_mark_dependencies (ptr); 2,666,432 => /home/wingo/src/guile/vm/libguile/gc-mark.c:scm_gc_mark_dependencies (5222x) 704 => /usr/src/debug////////glibc-20081113T2206/elf/../sysdeps/i386/dl-trampoline.S:_dl_runtime_resolve (1x) 595,758 } I think that the items on the left are cycle counts, and are of relative importance. The => lines are the cumulative costs of the subroutines. The salient point for me is that the scm_i_marking check slows down this function by about 10%! Also, that the majority of the time in this function is in the SCM_GC_MARK_P line. If I thought that we'd keep our GC, I would work at inlining this function, i think. Andy -- http://wingolog.org/