From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: profiling emacs-23.1 vs emacs-22.3 Date: Tue, 25 Aug 2009 15:07:50 +0900 Message-ID: References: <200908032029.n73KTi9h017528@godzilla.ics.uci.edu> <200908240807.n7O87ubg024643@godzilla.ics.uci.edu> <200908241826.n7OIQRhS001092@godzilla.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1251180502 3582 80.91.229.12 (25 Aug 2009 06:08:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2009 06:08:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 25 08:08:15 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MfpCX-0005CT-PK for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2009 08:08:14 +0200 Original-Received: from localhost ([127.0.0.1]:41915 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfpCW-0003yz-TJ for ged-emacs-devel@m.gmane.org; Tue, 25 Aug 2009 02:08:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MfpCL-0003yk-9e for emacs-devel@gnu.org; Tue, 25 Aug 2009 02:08:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MfpCF-0003yT-Ac for emacs-devel@gnu.org; Tue, 25 Aug 2009 02:08:00 -0400 Original-Received: from [199.232.76.173] (port=51165 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MfpCE-0003yQ-N5 for emacs-devel@gnu.org; Tue, 25 Aug 2009 02:07:54 -0400 Original-Received: from mx1.aist.go.jp ([150.29.246.133]:45307) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MfpCD-0000Pj-It for emacs-devel@gnu.org; Tue, 25 Aug 2009 02:07:54 -0400 Original-Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id n7P67p7G027502; Tue, 25 Aug 2009 15:07:51 +0900 (JST) env-from (handa@m17n.org) Original-Received: from smtp2.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id n7P67obh006268; Tue, 25 Aug 2009 15:07:50 +0900 (JST) env-from (handa@m17n.org) Original-Received: by smtp2.aist.go.jp with ESMTP id n7P67oqs028495; Tue, 25 Aug 2009 15:07:50 +0900 (JST) env-from (handa@m17n.org) Original-Received: from handa by etlken with local (Exim 4.69) (envelope-from ) id 1MfpCA-0000tG-EZ; Tue, 25 Aug 2009 15:07:50 +0900 In-reply-to: <200908241826.n7OIQRhS001092@godzilla.ics.uci.edu> (message from Dan Nicolaescu on Mon, 24 Aug 2009 11:26:27 -0700 (PDT)) X-detected-operating-system: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114573 Archived-At: In article <200908241826.n7OIQRhS001092@godzilla.ics.uci.edu>, Dan Nicolaescu writes: > Kenichi Handa writes: > In article <200908240807.n7O87ubg024643@godzilla.ics.uci.edu>, Dan Nicolaescu writes: > > > Could you try the attached patch? If it improves the > > > It does improve performance: > > How much in real time? > from 22 seconds to 19 (vs about 16 for 22.3 ) I see. Then it is worth installing that patch. I've just done it. > [...] > > It's still slower than 22.3 though. > > > One big difference is then time/number of calls to mark_objects > > 129733 vs 18834514, so 145 times more calls to mark_object. > > Do you know where do those come from? > > > The number of Fgarbage_collect calls does not increase that much: > > from 37 (for 22.3) to 43 (for 23.1). > > It seems that c-indent-region has been changed a lot. I'm > not sure, but perhaps that is the reason. How do the other > people think? > I set the load path to cc-mode from 22.3, it did not make any significant > difference in the amount of mark_object and Fgarbage_collect calls. Ok, then I suspect that the slowness is because of newly introduced char-tables. I've just installed the attached change too to improve the performance of object marking in GC. Please try again with the latest code. --- Kenichi Handa handa@m17n.org 2009-08-25 Kenichi Handa * alloc.c (mark_char_table): New function. (mark_object): Use mark_char_table for a char-table. --- alloc.c.~1.448.~ 2009-08-17 21:17:19.000000000 +0900 +++ alloc.c 2009-08-25 15:01:28.000000000 +0900 @@ -5371,6 +5371,34 @@ return 1; } +/* Like mark_vectorlike but optimized for char-tables (and + sub-char-tables) assuming that the contents are mostly integers or + symbols. */ + +static void +mark_char_table (ptr) + struct Lisp_Vector *ptr; +{ + register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK; + register int i; + + VECTOR_MARK (ptr); + for (i = 0; i < size; i++) + { + Lisp_Object val = ptr->contents[i]; + + if (INTEGERP (val) || SYMBOLP (val) && XSYMBOL (val)->gcmarkbit) + continue; + if (SUB_CHAR_TABLE_P (val)) + { + if (! VECTOR_MARKED_P (XVECTOR (val))) + mark_char_table (XVECTOR (val)); + } + else + mark_object (val); + } +} + void mark_object (arg) Lisp_Object arg; @@ -5533,6 +5561,11 @@ VECTOR_MARK (XVECTOR (h->key_and_value)); } } + else if (CHAR_TABLE_P (obj)) + { + if (! VECTOR_MARKED_P (XVECTOR (obj))) + mark_char_table (XVECTOR (obj)); + } else mark_vectorlike (XVECTOR (obj)); break;