From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Tobias C. Rittweiler" Newsgroups: gmane.emacs.devel Subject: Re: Low redisplay performance (23 regression) Date: Wed, 29 Apr 2009 19:35:52 +0200 Message-ID: <87skjrz7k7.fsf@freebits.de> References: <4870CC42-A08E-4BE9-B566-0F4DA7AB0B74@gmail.com> <878wlj228q.fsf@freebits.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1241026637 5393 80.91.229.12 (29 Apr 2009 17:37:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Apr 2009 17:37:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 29 19:37:01 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 1LzDiM-0002Qd-Pq for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 19:37:00 +0200 Original-Received: from localhost ([127.0.0.1]:50222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LzDiM-0002sm-3X for ged-emacs-devel@m.gmane.org; Wed, 29 Apr 2009 13:36:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LzDhc-0002eS-M9 for emacs-devel@gnu.org; Wed, 29 Apr 2009 13:36:12 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LzDhX-0002cB-N9 for emacs-devel@gnu.org; Wed, 29 Apr 2009 13:36:11 -0400 Original-Received: from [199.232.76.173] (port=45095 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LzDhX-0002c2-54 for emacs-devel@gnu.org; Wed, 29 Apr 2009 13:36:07 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:58034 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LzDhW-0000vW-1i for emacs-devel@gnu.org; Wed, 29 Apr 2009 13:36:06 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LzDhT-0005Bq-93 for emacs-devel@gnu.org; Wed, 29 Apr 2009 17:36:03 +0000 Original-Received: from host145.natpool.mwn.de ([138.246.7.145]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Apr 2009 17:36:03 +0000 Original-Received: from tcr by host145.natpool.mwn.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Apr 2009 17:36:03 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 159 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: host145.natpool.mwn.de User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:bf4h8JP2vtZ8kpxs9lZR9jS+mE8= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:110549 Archived-At: Stefan Monnier writes: > > As I use `end-of-defun' in my customized > > `font-lock-extend-region-functions' this does have an impact on the > > overall performance of fontification for me on large files. > > I don't think the size of the file (aka buffer) should make > a difference. Yes, I meant to write on large defuns. I test this on a file which contains defuns spanning up to 500-600 lines. > And I can't think of a good reason why EOD should take a > non-negligible amount of time compared to running > font-lock-fontify-region on a whole defun at a time. Find the below profiling outputs. The first is for Emacs 22.1.1, the second for 23.0.92.1 (checked out, and built today.) I used `elp' to do the profiling. I profiled the slime package, the font-lock package, and the jit-lock package. As well as `beginning-of-defun', `beginning-of-defun-raw', and `end-of-defun'. Then I open a file, and scroll down to the end using Page Down. (`slime-extend-region-for-defun' is a font-lock extend-region function which calls `slime-region-for-extended tlf-at-point' which in turns call `slime-region-for-tlf-at-point' which calls `end-of-defun' once, and `beginning-of-defun' several times. `slime-search-suppressed-forms' is a marker function on `font-lock-keywords'.) You'll see in the profiling output that basically all functions run slower on 23.x. It's still fast enough except for the extreme cases of defuns spanning over 500 lines. I'm not sure how much you can do with this information. But I can concur with the OP that there does seem to be a performance regression. -T. PS. GNU Emacs 22.1.1 Function Name Call Count Elapsed Time Average Time ========================================================= ========== ============ ============ jit-lock-function 478 6.0523169999 0.0126617510 jit-lock-fontify-now 478 6.0471380000 0.0126509163 font-lock-fontify-region 478 5.9743459999 0.0124986317 font-lock-default-fontify-region 478 5.9653550000 0.0124798221 slime-extend-region-for-font-lock 954 2.8670120000 0.0030052536 font-lock-fontify-keywords-region 478 2.2039999999 0.0046108786 slime-region-for-tlf-at-point 924 1.9189019999 0.0020767337 end-of-defun 1848 1.6501459999 0.0008929361 slime-region-for-extended-tlf-at-point 461 1.213281 0.0026318459 slime-search-suppressed-forms 922 1.0144610000 0.0011002830 font-lock-fontify-syntactically-region 478 0.747676 0.0015641757 beginning-of-defun-raw 4233 0.5864199999 0.0001385353 beginning-of-defun 2382 0.5515089999 0.0002315319 slime-forward-sexp 220 0.0974470000 0.0004429409 slime-forward-cruft 220 0.0939059999 0.0004268454 slime-eval-feature-conditional 444 0.0917369999 0.0002066148 slime-lisp-features 444 0.0813829999 0.0001832950 slime-forward-blanks 220 0.0522439999 0.0002374727 font-lock-extend-region-wholelines 954 0.0449930000 4.716...e-05 slime-forward-any-comment 220 0.0356580000 0.0001620818 font-lock-unfontify-region 478 0.0288390000 6.033...e-05 font-lock-default-unfontify-region 478 0.0204609999 4.280...e-05 slime-pre-command-hook 106 0.0053909999 5.085...e-05 slime-connection 444 0.0053260000 1.199...e-05 font-lock-extend-region-multiline 954 0.0042749999 4.481...e-06 slime-keywordify 444 0.0030740000 6.923...e-06 slime-connected-p 922 0.0023909999 2.593...e-06 font-lock-set-defaults 484 0.0016050000 3.316...e-06 jit-lock-context-fontify 7 0.0012900000 0.0001842857 slime-forward-reader-conditional 220 0.0011560000 5.254...e-06 slime-current-connection 444 0.0010020000 2.256...e-06 font-lock-mode 8 0.0009860000 0.0001232500 font-lock-default-function 8 0.0007859999 9.824...e-05 font-lock-mode-internal 2 0.000696 0.000348 slime-post-command-hook 106 0.0006859999 6.471...e-06 font-lock-turn-on-thing-lock 2 0.000424 0.000212 jit-lock-register 2 0.0003670000 0.0001835000 jit-lock-mode 2 0.000339 0.0001695 jit-lock-refontify 2 0.0003019999 0.0001509999 font-lock-compile-keywords 2 0.000188 9.4e-05 slime-lisp-mode-hook 1 7.9e-05 7.9e-05 font-lock-compile-keyword 32 6.7e-05 2.09375e-06 slime-mode 1 6.3e-05 6.3e-05 font-lock-change-mode 1 5.3e-05 5.3e-05 font-lock-add-keywords 2 4.6e-05 2.3e-05 slime-setup-command-hooks 1 3.4e-05 3.4e-05 slime-add-local-hook 2 2.100...e-05 1.050...e-05 font-lock-remove-keywords 2 2.100...e-05 1.050...e-05 font-lock-value-in-major-mode 5 1.1e-05 2.2e-06 font-lock-eval-keywords 2 9e-06 4.5e-06 slime-setup-first-change-hook 1 5e-06 5e-06 slime-add-easy-menu 1 4e-06 4e-06 font-lock-choose-keywords 1 3e-06 3e-06 ------------------------------------------------------------ GNU Emacs 23.0.92.1 jit-lock-function 478 9.4705599999 0.0198128870 jit-lock-fontify-now 478 9.4663009999 0.0198039769 font-lock-fontify-region 478 9.4454880000 0.0197604351 font-lock-default-fontify-region 478 9.4372980000 0.0197433012 font-lock-fontify-keywords-region 478 4.463293 0.0093374330 slime-extend-region-for-font-lock 954 3.9002370000 0.0040882987 slime-region-for-tlf-at-point 924 2.8002330000 0.0030305551 end-of-defun 1848 2.5033839999 0.0013546450 slime-region-for-extended-tlf-at-point 461 1.6439540000 0.0035660607 slime-search-suppressed-forms 922 1.5033249999 0.0016305043 font-lock-fontify-syntactically-region 478 1.0036810000 0.0020997510 beginning-of-defun-raw 4233 0.4824060000 0.0001139631 beginning-of-defun 2382 0.4037609999 0.0001695050 slime-eval-feature-conditional 444 0.0967099999 0.0002178153 slime-lisp-features 444 0.0876879999 0.0001974954 slime-forward-sexp 220 0.0707279999 0.0003214909 slime-forward-cruft 220 0.0670999999 0.0003049999 slime-forward-any-comment 220 0.04091 0.0001859545 font-lock-unfontify-region 478 0.0276759999 5.789...e-05 slime-forward-blanks 220 0.0211710000 9.623...e-05 font-lock-default-unfontify-region 478 0.0208749999 4.367...e-05 slime-pre-command-hook 111 0.0053809999 4.847...e-05 slime-connection 444 0.0052940000 1.192...e-05 font-lock-extend-region-multiline 954 0.0036339999 3.809...e-06 font-lock-extend-region-wholelines 954 0.0034359999 3.601...e-06 slime-keywordify 444 0.0028710000 6.466...e-06 slime-connected-p 922 0.0023109999 2.506...e-06 font-lock-set-defaults 484 0.0016920000 3.495...e-06 jit-lock-context-fontify 7 0.001305 0.0001864285 slime-forward-reader-conditional 220 0.0010509999 4.777...e-06 slime-current-connection 444 0.0009630000 2.168...e-06 font-lock-mode 8 0.000752 9.4e-05 slime-post-command-hook 111 0.0006969999 6.279...e-06 font-lock-default-function 8 0.00055 6.875e-05 font-lock-mode-internal 2 0.000459 0.0002295 font-lock-compile-keywords 2 0.000271 0.0001355 font-lock-turn-on-thing-lock 2 0.000151 7.55e-05 jit-lock-register 2 9.6e-05 4.8e-05 font-lock-compile-keyword 32 8.500...e-05 2.656...e-06 jit-lock-mode 2 7.1e-05 3.55e-05 slime-lisp-mode-hook 1 6.7e-05 6.7e-05 slime-mode 1 5.9e-05 5.9e-05 font-lock-change-mode 1 5.2e-05 5.2e-05 font-lock-add-keywords 2 4.6e-05 2.3e-05 jit-lock-refontify 2 3.7e-05 1.85e-05 slime-setup-command-hooks 1 3.2e-05 3.2e-05 font-lock-remove-keywords 2 2.100...e-05 1.050...e-05 slime-add-local-hook 2 1.8e-05 9e-06 font-lock-eval-keywords 2 1.5e-05 7.5e-06 font-lock-value-in-major-mode 5 1.1e-05 2.2e-06 slime-setup-first-change-hook 1 5e-06 5e-06 font-lock-choose-keywords 1 4e-06 4e-06 slime-add-easy-menu 1 3e-06 3e-06