From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.bugs Subject: bug#4222: calls to char_table_ref slow down 23.1 (vs 22.3) Date: Thu, 20 Aug 2009 22:18:10 -0700 (PDT) Message-ID: <200908210518.n7L5IAN1015939@godzilla.ics.uci.edu> Reply-To: Dan Nicolaescu , 4222@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250833637 11708 80.91.229.12 (21 Aug 2009 05:47:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Aug 2009 05:47:17 +0000 (UTC) To: bug-gnu-emacs Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 21 07:47:11 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MeMxy-0007Py-AX for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Aug 2009 07:47:10 +0200 Original-Received: from localhost ([127.0.0.1]:52931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeMxx-0002O5-Bq for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Aug 2009 01:47:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeMxp-0002Ns-E1 for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:47:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeMxj-0002NM-3e for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:47:00 -0400 Original-Received: from [199.232.76.173] (port=54669 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeMxi-0002NF-TA for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:46:54 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:53157) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MeMxi-00005v-2D for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:46:54 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7L5kpoo020216; Thu, 20 Aug 2009 22:46:51 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n7L5U4dh017440; Thu, 20 Aug 2009 22:30:04 -0700 Resent-Date: Thu, 20 Aug 2009 22:30:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Dan Nicolaescu Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Fri, 21 Aug 2009 05:30:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 4222 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.125083200615506 (code B ref -1); Fri, 21 Aug 2009 05:30:04 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 21 Aug 2009 05:20:06 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7L5K54T015472 for ; Thu, 20 Aug 2009 22:20:06 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeMXk-0006w1-Ka for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:20:04 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeMXf-0006rO-V2 for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:20:03 -0400 Original-Received: from [199.232.76.173] (port=49296 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeMXf-0006rL-Lt for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:19:59 -0400 Original-Received: from sallyv2.ics.uci.edu ([128.195.1.120]:47597) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1MeMXf-0003Uf-12 for bug-gnu-emacs@gnu.org; Fri, 21 Aug 2009 01:19:59 -0400 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by sallyv2.ics.uci.edu (8.13.8+Sun/8.13.8) with ESMTP id n7L5IBGq000591 for ; Thu, 20 Aug 2009 22:18:11 -0700 (PDT) Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id n7L5IAN1015939; Thu, 20 Aug 2009 22:18:10 -0700 (PDT) Original-Lines: 88 X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: n7L5IBGq000591 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 21 Aug 2009 01:46:59 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30407 Archived-At: Take src/config.h run C-x r t on it to insert a space in front of each line. Then build both emacs-23.1 and 22.3 with profiling enabled (-O2 -g -pg). Then run: emacs -Q -nw config.h M-: (indent-region (point-min)(point-max)) RET C-x C-c The 22.3 gprof results: Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 41.29 7.13 7.13 4653244 0.00 0.00 forw_comment 16.10 9.91 2.78 32473 0.09 0.31 scan_sexps_forward 9.09 11.48 1.57 15132 0.10 0.15 re_search_2 5.62 12.45 0.97 17286 0.06 0.15 scan_lists 5.59 13.41 0.96 33462255 0.00 0.00 lookup_char_property 3.36 13.99 0.58 18478958 0.00 0.00 next_interval 2.14 14.37 0.37 129733 0.00 0.00 mark_object 1.80 14.68 0.31 137020 0.00 0.00 skip_chars 1.74 14.97 0.30 14459993 0.00 0.00 previous_interval 1.62 15.26 0.28 57446793 0.00 0.00 Fcdr 1.36 15.49 0.23 2156082 0.00 0.00 update_syntax_table 1.27 15.71 0.22 3315615 0.00 0.00 re_match_2_internal 1.19 15.91 0.20 23687203 0.00 0.00 Fassq 0.87 16.07 0.15 13478 0.01 0.06 Fprevious_single_property_change 0.75 16.20 0.13 33462255 0.00 0.00 textget 0.75 16.32 0.13 228439 0.00 0.00 Fbyte_code 0.52 16.41 0.09 1978403 0.00 0.00 update_interval 0.46 16.50 0.08 1101056 0.00 0.00 find_interval 0.29 16.55 0.05 3613429 0.00 0.00 buf_bytepos_to_charpos 0.26 16.59 0.04 10137050 0.00 0.00 Fcar 0.26 16.64 0.04 1154883 0.00 0.00 balance_an_interval 0.23 16.68 0.04 579275 0.00 0.00 unbind_to The 23.1 gprof results: Flat profile: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 29.60 7.03 7.03 406111658 0.00 0.00 char_table_ref 26.72 13.37 6.34 4653244 0.00 0.00 forw_comment 11.80 16.17 2.80 32121 0.00 0.00 scan_sexps_forward 5.98 17.59 1.42 23271 0.00 0.00 re_search_2 5.27 18.84 1.25 17289 0.00 0.00 scan_lists 4.13 19.82 0.98 33439981 0.00 0.00 lookup_char_property 1.94 20.28 0.46 18488739 0.00 0.00 next_interval 1.73 20.69 0.41 10038210 0.00 0.00 mark_object 1.26 20.99 0.30 2156799 0.00 0.00 update_syntax_table 1.20 21.27 0.29 sub_char_table_ref 1.10 21.53 0.26 14455134 0.00 0.00 previous_interval 0.88 21.74 0.21 57391428 0.00 0.00 Fcdr 0.88 21.95 0.21 3318263 0.00 0.00 re_match_2_internal 0.72 22.12 0.17 23671456 0.00 0.00 Fassq 0.67 22.28 0.16 196373 0.00 0.00 Fbyte_code 0.59 22.42 0.14 13478 0.00 0.00 Fprevious_single_property_change 0.51 22.54 0.12 38 0.00 0.02 Fgarbage_collect 0.38 22.63 0.09 33439981 0.00 0.00 textget 0.38 22.72 0.09 10115583 0.00 0.00 Fcar [snip] ----------------------------------------------- 0.05 0.22 612/32121 back_comment [28] 2.75 11.33 31509/32121 Fparse_partial_sexp [6] [5] 60.5 2.80 11.55 32121 scan_sexps_forward [5] 5.17 3.76 3796695/4653244 forw_comment [7] 1.62 0.00 93379139/406111658 char_table_ref [8] 0.15 0.86 1092890/2156799 update_syntax_table [11] 0.00 0.00 5096/10115583 Fcar [46] 0.00 0.00 6552/57391428 Fcdr [33] 0.00 0.00 147/952550 Fcons [105] It can be seen that 23.1 is quite a bit slower, and that it has a lot of extra calls to char_table_ref. Is there some easy way to reduce the number of those calls?