unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: acm@muc.de, emacs-devel@gnu.org, schwab@suse.de
Subject: Re: What makes set-window-buffer slow?
Date: Fri, 24 Jun 2016 08:33:25 -0400	[thread overview]
Message-ID: <576D2895.4020600@gmail.com> (raw)
In-Reply-To: <83bn2r2i0y.fsf@gnu.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 1283 bytes --]

On 2016-06-24 02:54, Eli Zaretskii wrote:
>> From: Clément Pit--Claudel <clement.pit@gmail.com> Cc: acm@muc.de,
>> schwab@suse.de, emacs-devel@gnu.org Date: Thu, 23 Jun 2016 17:23:54
>> -0400
>> 
>> On 2016-06-23 15:11, Eli Zaretskii wrote:
>>> Instead of hypothesizing, I suggest to profile your code with 
>>> profiler.el.  If indeed redisplay is taking the time, you should
>>> see that in the profile.
>> 
>> The profile doesn't show that, unfortunately; in fact, we spent a
>> significant amount of time trying to understand what was taking all
>> that time by looking at the profile, but nothing in there was
>> taking more than 30% of the time, and even optimizing away a
>> function that according to the profile took 28% of the time didn't
>> yield a measurable runtime difference.
>> 
>> Commenting out the call to set-window-buffer (or predicating it on
>> the window not already displaying the buffer), on the other hand,
>> does yield a 95% performance gain.  set-window-buffer does not
>> appear in the profile; redisplay_internal does appear, but it only
>> is credited with 30% of the execution time.
>> 
>> I wonder what might explain these results...
> 
> Any hope of seeing the profile, fully expanded?

Absolutely. I've attached it.


[-- Attachment #1.1.2: mergesort-profile2 --]
[-- Type: text/plain, Size: 13830 bytes --]


[profiler-profile "24.3" cpu #s(hash-table size 97 test equal rehash-size 1.5 rehash-threshold 0.8 data ([nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 3308 ["#<compiled 0x261fc9>" funcall with-no-warnings setq let ad-Advice-font-lock-fontify-keywords-region apply font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region run-hook-with-args "#<compiled 0xdcd5b5>" funcall jit-lock-fontify-now jit-lock-function recenter] 20 [end-of-buffer call-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil nil nil] 9 [font-lock-fontify-region run-hook-with-args "#<compiled 0xdcd765>" funcall jit-lock-fontify-now jit-lock-function recenter end-of-buffer call-interactively command-execute nil nil nil nil nil nil] 3 [read-event "#<compiled 0x9782d9>" funcall track-mouse eval mouse-drag-track mouse-drag-region call-interactively command-execute nil nil nil nil nil nil nil] 8 [byte-code tooltip-show tooltip-help-tips run-hook-with-args-until-success tooltip-timeout apply byte-code timer-event-handler nil nil nil nil nil nil nil nil] 6 [coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil nil nil] 14 ["#<compiled 0x45ce3b>" funcall syntax-ppss proof-buffer-syntactic-context coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil] 43 [proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 4 [proof-buffer-syntactic-context proof-inside-comment coq-looking-at-comment coq-find-comment-start coq-find-not-in-comment-backward coq-empty-command-p coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil] 5 ["#<compiled 0xe3cf8f>" funcall syntax-ppss proof-buffer-syntactic-context proof-inside-comment coq-looking-at-comment coq-find-not-in-comment-backward coq-empty-command-p coq-empty-command-p coq-empty-command-p coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto] 3 [coq-empty-command-p coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil nil] 4 [proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil nil nil nil nil nil] 4 ["#<compiled 0x974991>" funcall syntax-ppss proof-buffer-syntactic-context proof-inside-comment coq-looking-at-comment coq-find-not-in-comment-backward coq-empty-command-p coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute] 11 ["#<compiled 0x9928ad>" funcall syntax-ppss proof-buffer-syntactic-context proof-inside-comment coq-looking-at-comment coq-find-comment-start coq-find-not-in-comment-backward coq-empty-command-p coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively] 8 [syntax-ppss proof-buffer-syntactic-context coq-script-parse-cmdend-forward coq-script-parse-function proof-segment-up-to proof-segment-up-to-using-cache proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil] 4 [redisplay proof-shell-wait proof-shell-invisible-command coq-adapt-printing-width run-hooks proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil nil] 2 [proof-script-delete-secondary-spans proof-assert-semis proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 8 [apply coq-seq-get-library-dependencies coq-seq-map-module-id-to-obj-file coq-seq-check-module coq-seq-preprocess-require-commands run-hooks byte-code proof-extend-queue proof-assert-semis proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil] 7 [coq-seq-preprocess-require-commands run-hooks byte-code proof-extend-queue proof-assert-semis proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil nil nil] 3 [proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-add-to-queue proof-extend-queue proof-assert-semis proof-assert-until-point proof-toolbar-goto call-interactively command-execute nil nil nil nil nil] 2 [proof-done-advancing-other proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil] 4 [proof-set-overlay-arrow proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil] 13 [proof-toolbar-next-enable-p redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 19 [run-hooks proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil] 17 [proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil] 25 [redisplay--update-region-highlight "#<compiled 0xe6722f>" funcall redisplay--update-region-highlights apply "#<compiled 0x406067>" redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil] 2 [proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil nil nil] 7 [scomint-send-input proof-shell-insert proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil] 11 [proof-shell-handle-immediate-output proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil nil] 7 [company-coq-state-change run-hooks proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil] 4 [proof-unprocessed-begin proof-locked-region-full-p proof-toolbar-use-enable-p redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil] 1 [run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 4 [menu-bar-update-buffers redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 14 [redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 8 [proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil nil nil nil] 19 [proof-done-advancing-save proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil] 9 [file-remote-p redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 17 [display-graphic-p if eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil] 6 [proof-get-name-from-goal proof-done-advancing-save proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil] 2 [tool-bar-make-keymap redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 14 [image-search-load-path find-image eval "#<compiled 0x279bef>" mapcar tool-bar-make-keymap-1 tool-bar-make-keymap redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil] 3 [coq-set-state-infos run-hooks proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil] 2 [if company-coq-state-change run-hooks proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil] 1 [eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 7 [proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil nil] 2 [coq-count-match coq-module-opening-p coq-goal-command-p proof-done-advancing-other proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil] 4 [coq-search-urgent-message proof-shell-process-urgent-messages proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil nil] 4 [if eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil] 19 [keymap-canonicalize redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 5 [proof-shell-insert proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil] 2 [mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil] 2 [proof-element-id proof-next-element-id proof-done-advancing-other proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil] 1 [unless eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil] 4 [byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil nil nil nil nil] 9 [progn if let if let company-coq-state-change run-hooks proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper] 5 [coq-last-prompt-info coq-last-prompt-info-safe coq-set-state-infos run-hooks proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil] 4 [coq-count-match coq-module-opening-p coq-goal-command-p proof-done-advancing-save proof-done-advancing byte-code proof-shell-invoke-callback mapc proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil] 2 [and company-coq-boundp-string-match-p and let* if company-coq-maybe-proof-input-reload-things run-hooks proof-shell-insert proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil] 2 [run-hooks proof-shell-insert proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil] 5 [pg-processing-complete-hint proof-shell-exec-loop proof-shell-filter-manage-output proof-shell-filter byte-code proof-shell-filter-wrapper run-hook-with-args scomint-output-filter nil nil nil nil nil nil nil nil] 6 ["#<compiled 0x261fc9>" funcall with-no-warnings setq let ad-Advice-font-lock-fontify-keywords-region apply font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region run-hook-with-args "#<compiled 0xe64a05>" funcall jit-lock-fontify-now jit-lock-function pos-visible-in-window-p] 4 [completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil nil nil nil nil nil nil] 38 [read-from-minibuffer completing-read-default completing-read read-extended-command byte-code call-interactively command-execute nil nil nil nil nil nil nil nil nil] 78 [profiler-cpu-profile profiler-report-cpu profiler-report call-interactively command-execute execute-extended-command call-interactively command-execute nil nil nil nil nil nil nil nil] 10 [Automatic\ GC] 53)) (22380 15820 895462 621000) nil]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2016-06-24 12:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 15:48 What makes set-window-buffer slow? Clément Pit--Claudel
2016-06-23 16:01 ` Andreas Schwab
2016-06-23 17:45   ` Clément Pit--Claudel
2016-06-23 18:12     ` Alan Mackenzie
2016-06-23 18:30       ` Clément Pit--Claudel
2016-06-23 19:11         ` Eli Zaretskii
2016-06-23 21:23           ` Clément Pit--Claudel
2016-06-24  6:54             ` Eli Zaretskii
2016-06-24 12:33               ` Clément Pit--Claudel [this message]
2016-06-24 13:56                 ` Eli Zaretskii
2016-06-24 14:19                   ` Clément Pit--Claudel
2016-06-24 18:31                     ` Clément Pit--Claudel
2016-06-24 19:13                     ` Eli Zaretskii
2016-06-24 21:33                       ` Clément Pit--Claudel
2016-06-25  7:30                         ` Eli Zaretskii
2016-06-25 14:07                           ` Clément Pit--Claudel
2016-06-25 14:27                             ` Eli Zaretskii
2016-06-25 14:39                               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576D2895.4020600@gmail.com \
    --to=clement.pit@gmail.com \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).