unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
@ 2017-04-15 20:28 Clément Pit-Claudel
  2017-04-15 20:33 ` Clément Pit-Claudel
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Clément Pit-Claudel @ 2017-04-15 20:28 UTC (permalink / raw)
  To: 26525

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

Hi bug-gnu-emacs,

I have attached a profile in which Flyspell's flyspell-check-word-p consumes 89% of CPU time while typing text in a buffer.  This seems to be due to a call to sit-for in flyspell-check-word-p.  What is this sit-for there for?

- flyspell-post-command-hook                                     6077  89%
 - flyspell-check-word-p                                         6073  89%
  - sit-for                                                      6067  89%
   - read-event                                                  3826  56%
    + redisplay_internal (C function)                             128   1%
    + timer-event-handler                                          91   1%
    + fstar-subp-filter                                             3   0%
   - redisplay                                                   2205  32%
    + redisplay_internal (C function)                             100   1%
  + flyspell-get-not-casechars                                      2   0%
 + flyspell-check-pre-word-p                                        4   0%
+ command-execute                                                 220   3%
+ ...                                                             131   1%
+ timer-event-handler                                             116   1%
+ redisplay_internal (C function)                                 114   1%
+ company-post-command                                            102   1%
+ flycheck-perform-deferred-syntax-check                            5   0%
+ eldoc-pre-command-refresh-echo-area                               3   0%
  sml/generate-position-help                                        1   0%

I haven't spent much time investigating this issue yet, and my current repro isn't exactly reliable, but I was hoping that someone might be able to provide insight into Flyspell's behaviour before I dive to deep :) I did verify that disabling Flyspell fixed the issue.

Thanks!
Clément.

[-- Attachment #2: flyspell.prof --]
[-- Type: text/plain, Size: 35632 bytes --]


[profiler-profile "24.3" cpu #s(hash-table size 217 test equal rehash-size 1.5 rehash-threshold 0.8125 data ([redisplay sit-for execute-extended-command smex-read-and-run smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil] 13 [read-event sit-for execute-extended-command smex-read-and-run smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil] 22 [apply "#<compiled 0x46efc7>" redisplay_internal\ \(C\ function\) read-event sit-for execute-extended-command smex-read-and-run smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil] 1 [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 2521 [redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil nil nil nil] 2105 [read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil nil nil nil] 3604 [sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil nil nil nil nil] 36 [json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let fstar-subp--query if fstar-subp--query-and-wait-1 let*] 6 ["#<compiled 0x11b1aef>" mapconcat rm--mode-list-as-string-list sml/generate-minor-modes eval posn-at-point company--col-row company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler read-event] 5 [company-pseudo-tooltip-show company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil] 16 [company--col-row company--row company--pseudo-tooltip-height company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command nil nil nil nil nil nil nil nil nil] 34 [company-fill-propertize company--create-lines company-pseudo-tooltip-edit company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company--perform company-post-command nil nil nil nil nil nil nil nil] 13 [font-lock-fontify-syntactically-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x12e23fd>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil] 18 [if and let "#<lambda 0x2bcdceff447a34>" funcall if "#<lambda 0x15c97795d86fa532>" funcall unwind-protect let* fstar-subp--process-response progn if let cond save-current-buffer] 1 [company-safe-substring company-fill-propertize company--create-lines company-pseudo-tooltip-edit company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company--perform company-post-command nil nil nil nil nil nil nil] 8 [font-lock-prepend-text-property font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x1495581>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil] 12 [while "#<lambda 0xe38a23f3eef61>" syntax-propertize internal--syntax-propertize skip-syntax-backward company-grab-symbol let progn unwind-protect let progn if cond progn if fstar-subp-company-backend] 3 [apply json-read json-read-array apply json-read json-read-array apply json-read json-read-object apply json-read condition-case progn if let* fstar-subp-json--read-response] 9 [font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x127a8b5>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil] 15 [rm-format-mode-line-entry mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil] 16 [json-encode-array json-encode-list json-encode "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq] 1 [font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0xc51b1f>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function posn-at-point company--col-row company--row company--pseudo-tooltip-height company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command] 8 [and while "#<lambda 0xe38a23f3eef61>" syntax-propertize internal--syntax-propertize skip-syntax-backward company-grab-symbol let progn unwind-protect let progn if cond progn if] 5 [mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil] 4 [company--force-sync company-call-backend company-calculate-candidates company--continue company--perform company-post-command nil nil nil nil nil nil nil nil nil nil] 6 [company--force-sync company-call-backend company-fetch-metadata company-echo-show apply timer-event-handler nil nil nil nil nil nil nil nil nil nil] 3 [redisplay--update-region-highlight run-hook-with-args redisplay--pre-redisplay-functions apply "#<compiled 0x46efc7>" redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil] 1 ["#<compiled 0x18391a5>" json-read-from-string json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let fstar-subp--query let*] 1 [pos-tip-show company-quickhelp--show apply timer-event-handler nil nil nil nil nil nil nil nil nil nil nil nil] 5 [jit-lock-function posn-at-point pos-tip-compute-pixel-position pos-tip-show-no-propertize pos-tip-show company-quickhelp--show apply timer-event-handler nil nil nil nil nil nil nil nil] 3 [syntax-ppss prettify-symbols-default-compose-p prettify-symbols--compose-symbol eval font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x10aae01>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) redisplay pos-tip-compute-pixel-position pos-tip-show-no-propertize] 4 [redisplay pos-tip-compute-pixel-position pos-tip-show-no-propertize pos-tip-show company-quickhelp--show apply timer-event-handler nil nil nil nil nil nil nil nil nil] 16 [face-attribute face-attr-match-p frame-set-background-mode internal-set-lisp-face-attribute set-face-attribute apply face-spec-set-2 face-spec-recalc face-set-after-frame-default x-show-tip pos-tip-show-no-propertize pos-tip-show company-quickhelp--show apply timer-event-handler nil] 11 [check-face face-name set-face-attribute-from-resource set-face-attributes-from-resources make-face-x-resource-internal face-spec-recalc frame-set-background-mode internal-set-lisp-face-attribute set-face-attribute apply face-spec-set-2 face-spec-recalc face-set-after-frame-default x-show-tip pos-tip-show-no-propertize pos-tip-show] 4 [facep check-face face-name set-face-attribute-from-resource set-face-attributes-from-resources make-face-x-resource-internal face-spec-recalc frame-set-background-mode internal-set-lisp-face-attribute set-face-attribute apply face-spec-set-2 face-spec-recalc face-set-after-frame-default x-show-tip pos-tip-show-no-propertize] 8 [set-face-attribute apply face-spec-reset-face face-spec-recalc frame-set-background-mode internal-set-lisp-face-attribute set-face-attribute apply face-spec-set-2 face-spec-recalc face-set-after-frame-default x-show-tip pos-tip-show-no-propertize pos-tip-show company-quickhelp--show apply] 4 [set-face-attribute-from-resource set-face-attributes-from-resources make-face-x-resource-internal face-spec-recalc face-set-after-frame-default x-show-tip pos-tip-show-no-propertize pos-tip-show company-quickhelp--show apply timer-event-handler nil nil nil nil nil] 3 [facep check-face face-name set-face-attribute-from-resource set-face-attributes-from-resources make-face-x-resource-internal face-spec-recalc face-set-after-frame-default x-show-tip pos-tip-show-no-propertize pos-tip-show company-quickhelp--show apply timer-event-handler nil nil] 4 [set-face-attribute apply face-spec-reset-face face-spec-recalc face-set-after-frame-default x-show-tip pos-tip-show-no-propertize pos-tip-show company-quickhelp--show apply timer-event-handler nil nil nil nil nil] 12 [ispell-decode-string ispell-get-decoded-string ispell-get-otherchars flyspell-check-pre-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil nil nil] 4 [funcall eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil] 4 [rm-format-mode-line-entry mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 12 [json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let fstar-subp--query if fstar-subp-company--async-lookup fstar-subp-company--async-meta] 3 [ruler-mode-ruler funcall eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil] 4 [apply json-read json-read-from-string json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query] 3 [sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil] 4 [syntax-ppss font-lock-fontify-syntactically-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x110b819>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil] 12 [sml/generate-modified-status eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil] 22 [flycheck-finish-current-syntax-check flycheck-report-buffer-checker-status apply "#<compiled 0x1203ad3>" funcall let* if fstar-subp--flycheck-continuation apply "#<compiled 0x1203e91>" funcall unwind-protect let* fstar-subp--process-response progn if] 3 [fstar-subp-next-block-sep let while let save-excursion fstar-subp--next-unprocessed-start let if fstar-subp--start-syntax-check flycheck-syntax-check-start flycheck-start-current-syntax-check flycheck-buffer flycheck-buffer-automatically flycheck-perform-deferred-syntax-check nil nil] 5 ["#<compiled 0x11b1aef>" mapconcat rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil] 8 [file-remote-p redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 4 [syntax-ppss font-lock-fontify-syntactically-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x19ed3cb>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) nil nil nil nil nil nil] 8 [and if fstar-subp-start let fstar-subp--query if fstar-subp--query-and-wait-1 let* fstar-subp--query-and-wait let* progn if if let fstar--eldoc-function eldoc-print-current-symbol-info] 4 [self-insert-command funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil nil nil nil nil] 1 [apply eldoc-minibuffer-message "#<compiled 0x28eb17>" apply let if fstar--eldoc-truncate-message apply eldoc-message eldoc-print-current-symbol-info "#<compiled 0x28ea7d>" apply timer-event-handler nil nil nil] 3 [flycheck-clear-idle-change-timer flycheck-handle-idle-change apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil] 1 [ruler-mode-ruler funcall eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil] 17 ["#<compiled 0x11b1b5f>" mapcar rm--remove-hidden-modes rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil] 8 [json-read-escaped-char json-read-string apply json-read json-read-object apply json-read json-read-array apply json-read json-read-object apply json-read condition-case progn if] 3 ["#<compiled 0x11b1aef>" mapconcat rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 12 [sml/generate-modified-status eval format-mode-line sml/fill-width-available sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil] 4 [rm-format-mode-line-entry mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 4 [sml/generate-position-help nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 1 [while if fstar-subp--query-and-wait-1 let* fstar-subp--query-and-wait let* progn if if let fstar--eldoc-function eldoc-print-current-symbol-info "#<compiled 0x28ea7d>" apply timer-event-handler nil] 3 [sml/fill-width-available sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil] 4 [apply let* save-current-buffer fstar--log progn if if let if save-current-buffer fstar-subp-process-queue apply timer-event-handler nil nil nil] 4 [flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 4 [fstar-subp-filter accept-process-output while if fstar-subp--query-and-wait-1 let* fstar-subp--query-and-wait let fstar-subp-company-candidates cond progn if fstar-subp-company-backend apply company-call-backend-raw company--fetch-candidates] 1 ["#<compiled 0x11b1aef>" mapconcat rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 19 [cdr let* let cond let* format my-flycheck-mode-line-status-text eval format-mode-line rm-format-mode-line-entry mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event] 8 [json-encode "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if] 3 [font-lock-fontify-syntactically-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x10fc961>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil] 12 [save-current-buffer progn if let if let if let let let progn if let* while fstar-subp-json--find-response if] 2 [json-join json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let fstar-subp--query if fstar-subp--query-and-wait-1 let* fstar-subp--query-and-wait let*] 3 [font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x1a832ff>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil] 4 [sml/generate-modified-status eval format-mode-line sml/fill-width-available sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil] 8 [apply eldoc-minibuffer-message "#<compiled 0x28eb17>" apply let if fstar--eldoc-truncate-message apply eldoc-message eldoc-pre-command-refresh-echo-area nil nil nil nil nil nil] 3 [company--col-row company--row company--pseudo-tooltip-height company-pseudo-tooltip-show company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook] 4 [company-buffer-lines company-pseudo-tooltip-show company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil] 4 [rm--propertize mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval posn-at-point company--col-row company--row company--pseudo-tooltip-height company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command nil nil nil] 6 ["#<compiled 0x1a84eb1>" funcall if let "#<lambda 0x32a0b8f8447a34>" funcall if "#<lambda 0x15c97795d86fa532>" funcall unwind-protect let* fstar-subp--process-response progn if let cond] 2 [apply "#<compiled 0x46efc7>" redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil] 4 [apply json-read json-read-object apply json-read json-read-array apply json-read json-read-object apply json-read condition-case progn if let* fstar-subp-json--read-response] 2 [funcall eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil] 4 [font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x17b0953>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil] 8 [and while if fstar-subp--query-and-wait-1 let* fstar-subp--query-and-wait let fstar-subp-company-candidates cond progn if fstar-subp-company-backend apply company-call-backend-raw company--fetch-candidates company-calculate-candidates] 4 [font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x1a8bbb7>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil] 4 [progn if let* let cond let* format my-flycheck-mode-line-status-text eval format-mode-line rm-format-mode-line-entry mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\)] 4 [run-hook-with-args jit-lock-after-change insert let* save-current-buffer fstar--log progn if progn if fstar-subp-filter read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil] 3 [sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil] 12 [rm--propertize mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 4 [tramp-flush-file-function kill-buffer "#<compiled 0x15eeb25>" json-read-from-string json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let] 3 [setq while let fstar-find-id-maybe-type fstar-find-id-with-type font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0xc53f21>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) redisplay sit-for] 3 [company--should-complete company--perform company-auto-begin company-idle-begin apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 3 [redisplay sit-for battery-update-handler apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil] 22 [jit-lock-function redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 8 [eq or save-excursion or and setq while let fstar-find-id-maybe-type fstar-find-id-with-type font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x16367f9>" run-hook-wrapped jit-lock--run-functions] 3 [syntax-ppss prettify-symbols-default-compose-p prettify-symbols--compose-symbol eval font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x14033f5>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) nil nil nil] 4 ["#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let] 3 [sml/generate-modified-status eval format-mode-line sml/fill-width-available sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil] 4 [sml/generate-modified-status eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil] 5 ["#<compiled 0x46efc7>" redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil nil] 2 [rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil] 4 [company--col-row company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil] 3 [eval rm--propertize mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil] 4 [font-lock-fontify-syntactically-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x1537351>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil] 4 [sml/fill-width-available sml/generate-minor-modes eval posn-at-point company--col-row company--row company--pseudo-tooltip-height company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command nil nil nil nil nil] 2 [syntax-ppss let* let cond while "#<lambda 0xe38a23f3eef61>" syntax-propertize internal--syntax-propertize skip-syntax-backward company-grab-symbol let progn unwind-protect let progn if] 1 [apply derived-mode-p save-place-to-alist kill-buffer "#<compiled 0x1ae204b>" company-safe-substring company-modify-line company--replacement-string apply company-pseudo-tooltip-edit company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company--perform company-post-command nil] 2 ["#<compiled 0x12030bd>" json-read-from-string json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let fstar-subp--query if] 2 [company--clean-string company--create-lines company-pseudo-tooltip-edit company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company--perform company-post-command nil nil nil nil nil nil nil nil] 4 [tramp-flush-file-function kill-buffer "#<compiled 0x193783f>" json-read-from-string json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let] 2 [beginning-of-visual-line company-pseudo-tooltip-guard company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command nil nil nil nil nil nil nil nil nil nil] 9 [json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let fstar-subp--query let* fstar-subp-peek-region if] 3 [let* save-current-buffer fstar--log progn if cond let* fstar-subp-json--read-response and let* while fstar-subp-json--find-response if fstar-subp-find-response save-current-buffer progn] 2 [redisplay--update-region-highlight run-hook-with-args redisplay--pre-redisplay-functions apply "#<compiled 0x46efc7>" redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 4 [company--force-sync company-call-backend company-fetch-metadata company-echo-show apply timer-event-handler read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil] 6 [funcall eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil nil nil nil] 4 [company-grab-symbol let progn unwind-protect let progn if cond progn if fstar-subp-company-backend company--begin-new company--perform company-auto-begin company-idle-begin apply] 2 [while if fstar-subp--query-and-wait-1 let* fstar-subp--query-and-wait let fstar-subp-company-candidates cond progn if fstar-subp-company-backend apply company-call-backend-raw company--fetch-candidates company-calculate-candidates company--begin-new] 2 [sml/fill-width-available sml/generate-minor-modes eval posn-at-point company--col-row company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler read-event sit-for flyspell-check-word-p] 4 [font-lock-prepend-text-property font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x121f07d>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil] 4 [fstar-find-id-with-type font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x1960333>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function posn-at-point company--col-row company--row company--pseudo-tooltip-height company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends] 4 [apply let* save-current-buffer fstar--log progn if cond let* fstar-subp-json--read-response and let* while fstar-subp-json--find-response if fstar-subp-find-response save-current-buffer] 4 [apply "#<compiled 0x46efc7>" redisplay_internal\ \(C\ function\) redisplay sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil] 4 [apply json-read json-read-array apply json-read json-read-object apply json-read condition-case progn if let* fstar-subp-json--read-response and let* while] 1 [company--col-row company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler nil nil nil nil nil nil nil] 4 [company-pseudo-tooltip-show company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler nil nil nil nil nil nil nil] 4 [ispell-decode-string ispell-get-decoded-string flyspell-get-not-casechars flyspell-check-word-p flyspell-post-command-hook nil nil nil nil nil nil nil nil nil nil nil] 2 [rm-format-mode-line-entry mapcar rm--mode-list-as-string-list sml/generate-minor-modes eval posn-at-point company--col-row company-pseudo-tooltip-show-at-point company-pseudo-tooltip-frontend company-pseudo-tooltip-unless-just-one-frontend company-call-frontends company-post-command company-idle-begin apply timer-event-handler read-event] 5 [get-buffer-create generate-new-buffer json-read-from-string json-encode-key "#<compiled 0x391c33>" mapcar json-encode-alist json-encode-list json-encode let fstar-subp--serialize-query setq progn if let fstar-subp--query] 2 [setq while let fstar-find-id-maybe-type fstar-find-id-with-type font-lock-fontify-keywords-region font-lock-default-fontify-region font-lock-fontify-region "#<compiled 0x465e09>" run-hook-wrapped jit-lock--run-functions jit-lock-fontify-now jit-lock-function posn-at-point company--col-row company--row] 3 [font-lock-default-fontify-region font-lock-fontify-region font-lock-default-fontify-buffer "#<compiled 0x4f4bc5>" font-lock-ensure if save-current-buffer fstar-highlight-string concat fstar-lookup-result-sig cond funcall fstar-subp-company--meta-continuation apply "#<compiled 0x17b0a23>" funcall] 2 [file-remote-p sml/generate-modified-status eval format-mode-line sml/fill-width-available sml/generate-minor-modes eval redisplay_internal\ \(C\ function\) read-event sit-for flyspell-check-word-p flyspell-post-command-hook nil nil nil nil] 4 [let fstar-subp--query let* fstar-subp-peek-region if let if fstar-subp--start-syntax-check flycheck-syntax-check-start flycheck-start-current-syntax-check flycheck-buffer flycheck-buffer-automatically flycheck-handle-idle-change apply timer-event-handler nil] 4 ["#<compiled 0xdb1dc3>" mapatoms smex-detect-new-commands smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil nil] 6 [mapatoms smex-rebuild-cache smex-update smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil nil] 20 ["#<compiled 0x48bd29>" mapatoms smex-rebuild-cache smex-update smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil] 4 [smex-sorting-rules sort smex-rebuild-cache smex-update smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil] 4 [sort smex-rebuild-cache smex-update smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil nil] 4 [smex-rebuild-cache smex-update smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively command-execute nil nil nil nil nil nil nil] 4 [mapc ido-set-matches-1 ido-set-matches "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex funcall-interactively "#<subr call-interactively>"] 4 ["#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply call-interactively] 6 [ido-set-matches-1 ido-set-matches ido-exhibit read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex funcall-interactively] 4 [read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex funcall-interactively "#<subr call-interactively>" ad-Advice-call-interactively apply] 80 ["#<compiled 0xee57f5>" mapc ido-set-matches-1 ido-set-matches ido-exhibit read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run] 5 [ido-word-matching-substring mapcar ido-find-common-substring ido-set-common-completion ido-exhibit read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run] 4 [ido-set-matches ido-exhibit read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex funcall-interactively "#<subr call-interactively>"] 2 [mapc ido-set-matches-1 ido-set-matches ido-exhibit read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex] 10 [sml/generate-modified-status eval redisplay_internal\ \(C\ function\) read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex funcall-interactively] 4 ["#<compiled 0xee5823>" mapc ido-set-matches-1 ido-set-matches ido-exhibit read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run] 8 ["#<compiled 0x46efc7>" redisplay_internal\ \(C\ function\) read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run smex funcall-interactively "#<subr call-interactively>"] 1 [window-current-scroll-bars ruler-mode-ruler funcall eval redisplay_internal\ \(C\ function\) read-from-minibuffer "#<compiled 0xedc525>" ad-Advice-ido-read-internal apply ido-read-internal "#<compiled 0xeea9e9>" ad-Advice-ido-completing-read apply ido-completing-read smex-completing-read smex-read-and-run] 5 [Automatic\ GC] 86)) (22770 32098 861101 964000) nil]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-15 20:28 bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU Clément Pit-Claudel
@ 2017-04-15 20:33 ` Clément Pit-Claudel
  2017-04-17  7:14   ` Eli Zaretskii
  2017-10-17 12:07 ` Damien Cassou
  2020-09-02 23:15 ` Nick H
  2 siblings, 1 reply; 16+ messages in thread
From: Clément Pit-Claudel @ 2017-04-15 20:33 UTC (permalink / raw)
  To: 26525

The relevant piece of code seems to be this:

      (cond
       ((get this-command 'flyspell-deplacement)
	(not (eq flyspell-previous-command this-command)))
       ((get this-command 'flyspell-delayed)
	;; The current command is not delayed, that
	;; is that we must check the word now.
	(and (not unread-command-events)
	     (sit-for flyspell-delay)))
       (t t)))

But the condition and the comment seem at odds, and it doesn't say much about why it calls `sit-for`.

Clément.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-15 20:33 ` Clément Pit-Claudel
@ 2017-04-17  7:14   ` Eli Zaretskii
  2017-04-17 13:29     ` Clément Pit-Claudel
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2017-04-17  7:14 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: 26525

> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Sat, 15 Apr 2017 16:33:56 -0400
> 
> The relevant piece of code seems to be this:
> 
>       (cond
>        ((get this-command 'flyspell-deplacement)
> 	(not (eq flyspell-previous-command this-command)))
>        ((get this-command 'flyspell-delayed)
> 	;; The current command is not delayed, that
> 	;; is that we must check the word now.
> 	(and (not unread-command-events)
> 	     (sit-for flyspell-delay)))
>        (t t)))
> 
> But the condition and the comment seem at odds, and it doesn't say much about why it calls `sit-for`.

I'm not quite sure what needs to be explained.  I think the doc string
of flyspell-delay and flyspell-default-delayed-commands tell the whole
story; if something is unclear there, please say what is unclear.

If you want to see this feature in action, turn on Flyspell, then type
something like "ssss", and then wait _without_ typing any non-word
character.  You will see that the mis-spelled word is marked only
after 3 sec, the default value of flyspell-delay.  Then contrast that
with the same word with a space typed after it.

IOW, this is a feature designed to avoid annoying users who type
slowly or make short breaks after typing only part of a word.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-17  7:14   ` Eli Zaretskii
@ 2017-04-17 13:29     ` Clément Pit-Claudel
  2017-04-17 14:25       ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Clément Pit-Claudel @ 2017-04-17 13:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 26525

On 2017-04-17 03:14, Eli Zaretskii wrote:
>> But the condition and the comment seem at odds, and it doesn't say much about why it calls `sit-for`.
> 
> I'm not quite sure what needs to be explained.  I think the doc string
> of flyspell-delay and flyspell-default-delayed-commands tell the whole
> story; if something is unclear there, please say what is unclear.

The code reads (cond ((get this-command 'flyspell-delayed) …)), but the comment says "The current command is not delayed".  Does a non-nil flycheck-delayed really mean that the command is *not* delayed?

> If you want to see this feature in action, turn on Flyspell, then type
> something like "ssss", and then wait _without_ typing any non-word
> character.  You will see that the mis-spelled word is marked only
> after 3 sec, the default value of flyspell-delay.  Then contrast that
> with the same word with a space typed after it.

Thanks! I don't expect that this feature is intended to slow down typing, though, right?  In the example I posted it makes typing painfully slow.

Clément.






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-17 13:29     ` Clément Pit-Claudel
@ 2017-04-17 14:25       ` Eli Zaretskii
  2017-04-17 15:36         ` Clément Pit-Claudel
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2017-04-17 14:25 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: 26525

> Cc: 26525@debbugs.gnu.org
> From: Clément Pit-Claudel <cpitclaudel@gmail.com>
> Date: Mon, 17 Apr 2017 09:29:20 -0400
> 
> On 2017-04-17 03:14, Eli Zaretskii wrote:
> >> But the condition and the comment seem at odds, and it doesn't say much about why it calls `sit-for`.
> > 
> > I'm not quite sure what needs to be explained.  I think the doc string
> > of flyspell-delay and flyspell-default-delayed-commands tell the whole
> > story; if something is unclear there, please say what is unclear.
> 
> The code reads (cond ((get this-command 'flyspell-delayed) …)), but the comment says "The current command is not delayed".  Does a non-nil flycheck-delayed really mean that the command is *not* delayed?

I think the comment should be moved 2 lines below its current place,
that's all.

> > If you want to see this feature in action, turn on Flyspell, then type
> > something like "ssss", and then wait _without_ typing any non-word
> > character.  You will see that the mis-spelled word is marked only
> > after 3 sec, the default value of flyspell-delay.  Then contrast that
> > with the same word with a space typed after it.
> 
> Thanks! I don't expect that this feature is intended to slow down typing, though, right?  In the example I posted it makes typing painfully slow.

I didn't see any example in your OP, only a profile.  What did I miss?

And no, this is not supposed to slow down typing in any significant
way, as long as you type, because sit-for is supposed to return as
soon as input is available.  Your complaint was about CPU usage, not
about time delays, AFAIU.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-17 14:25       ` Eli Zaretskii
@ 2017-04-17 15:36         ` Clément Pit-Claudel
  2020-08-13  1:41           ` Stefan Kangas
  0 siblings, 1 reply; 16+ messages in thread
From: Clément Pit-Claudel @ 2017-04-17 15:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 26525

On 2017-04-17 10:25, Eli Zaretskii wrote:
>> Thanks! I don't expect that this feature is intended to slow down typing, though, right?  In the example I posted it makes typing painfully slow.
> I didn't see any example in your OP, only a profile.  What did I miss?
> 
> And no, this is not supposed to slow down typing in any significant
> way, as long as you type, because sit-for is supposed to return as
> soon as input is available.  Your complaint was about CPU usage, not
> about time delays, AFAIU.

Indeed, there was only a profile; I don't have a good repro yet.  In that case, flyspell was slowing things down a lot, and the complaint was indeed about delays.
Sorry for being unclear.

Clément.






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-15 20:28 bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU Clément Pit-Claudel
  2017-04-15 20:33 ` Clément Pit-Claudel
@ 2017-10-17 12:07 ` Damien Cassou
  2020-08-28 11:49   ` Stefan Kangas
  2020-09-02 23:15 ` Nick H
  2 siblings, 1 reply; 16+ messages in thread
From: Damien Cassou @ 2017-10-17 12:07 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: 26525

> I have attached a profile in which Flyspell's flyspell-check-word-p
> consumes 89% of CPU time while typing text in a buffer. […]

This happened to me in the past then stopped for months. Now it happens
again and is really annoying. Emacs regularly freezes for around 5
seconds when I manipulate text.

-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-17 15:36         ` Clément Pit-Claudel
@ 2020-08-13  1:41           ` Stefan Kangas
  0 siblings, 0 replies; 16+ messages in thread
From: Stefan Kangas @ 2020-08-13  1:41 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: 26525

Clément Pit-Claudel <cpitclaudel@gmail.com> writes:

> On 2017-04-17 10:25, Eli Zaretskii wrote:
>>> Thanks! I don't expect that this feature is intended to slow down typing, though, right?  In the example I posted it makes typing painfully slow.
>> I didn't see any example in your OP, only a profile.  What did I miss?
>>
>> And no, this is not supposed to slow down typing in any significant
>> way, as long as you type, because sit-for is supposed to return as
>> soon as input is available.  Your complaint was about CPU usage, not
>> about time delays, AFAIU.
>
> Indeed, there was only a profile; I don't have a good repro yet.  In that case, flyspell was slowing things down a lot, and the complaint was indeed about delays.
> Sorry for being unclear.

That was 3 years ago.  Are you still seeing this on a recent version of
Emacs, such as the recently released 27.1?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-10-17 12:07 ` Damien Cassou
@ 2020-08-28 11:49   ` Stefan Kangas
  2020-08-28 12:35     ` Damien Cassou
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Kangas @ 2020-08-28 11:49 UTC (permalink / raw)
  To: Damien Cassou; +Cc: Clément Pit-Claudel, 26525

Damien Cassou <damien@cassou.me> writes:

>> I have attached a profile in which Flyspell's flyspell-check-word-p
>> consumes 89% of CPU time while typing text in a buffer. […]
>
> This happened to me in the past then stopped for months. Now it happens
> again and is really annoying. Emacs regularly freezes for around 5
> seconds when I manipulate text.

That was 3 years ago.  Are you still seeing this on a recent version of
Emacs, such as the recently released 27.1?

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2020-08-28 11:49   ` Stefan Kangas
@ 2020-08-28 12:35     ` Damien Cassou
  2020-08-28 18:40       ` Clément Pit-Claudel
  0 siblings, 1 reply; 16+ messages in thread
From: Damien Cassou @ 2020-08-28 12:35 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Clément Pit-Claudel, 26525

Stefan Kangas <stefan@marxist.se> writes:
> That was 3 years ago.  Are you still seeing this on a recent version of
> Emacs, such as the recently released 27.1?

This hasn't happened for some time.

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2020-08-28 12:35     ` Damien Cassou
@ 2020-08-28 18:40       ` Clément Pit-Claudel
  2020-08-29 16:27         ` Stefan Kangas
  0 siblings, 1 reply; 16+ messages in thread
From: Clément Pit-Claudel @ 2020-08-28 18:40 UTC (permalink / raw)
  To: Damien Cassou, Stefan Kangas; +Cc: 26525

On 8/28/20 8:35 AM, Damien Cassou wrote:
> Stefan Kangas <stefan@marxist.se> writes:
>> That was 3 years ago.  Are you still seeing this on a recent version of
>> Emacs, such as the recently released 27.1?
> 
> This hasn't happened for some time.
> 

There was a report of a similar issue on reddit recently, but it hasn't happened to me of late.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2020-08-28 18:40       ` Clément Pit-Claudel
@ 2020-08-29 16:27         ` Stefan Kangas
  2020-08-29 18:10           ` Clément Pit-Claudel
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Kangas @ 2020-08-29 16:27 UTC (permalink / raw)
  To: Clément Pit-Claudel, Damien Cassou; +Cc: 26525

tags 26525 + unreproducible
thanks

Clément Pit-Claudel <cpitclaudel@gmail.com> writes:

> On 8/28/20 8:35 AM, Damien Cassou wrote:
>> Stefan Kangas <stefan@marxist.se> writes:
>>> That was 3 years ago.  Are you still seeing this on a recent version of
>>> Emacs, such as the recently released 27.1?
>>
>> This hasn't happened for some time.
>>
>
> There was a report of a similar issue on reddit recently, but it hasn't happened to me of late.

You wouldn't happen to have a link to the relevant thread?  I tried
searching the web but couldn't find anything.

I'm marking this bug as unreproducible for now.  Please report back if
you see this again or can provide any more information.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2020-08-29 16:27         ` Stefan Kangas
@ 2020-08-29 18:10           ` Clément Pit-Claudel
  0 siblings, 0 replies; 16+ messages in thread
From: Clément Pit-Claudel @ 2020-08-29 18:10 UTC (permalink / raw)
  To: Stefan Kangas, Damien Cassou; +Cc: 26525

On 8/29/20 12:27 PM, Stefan Kangas wrote:
> You wouldn't happen to have a link to the relevant thread?  I tried
> searching the web but couldn't find anything.

https://www.reddit.com/r/emacs/comments/i96lbo/flyspell_consuming_most_of_my_resources_why_oo/ , sorry for not including it the first time.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2017-04-15 20:28 bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU Clément Pit-Claudel
  2017-04-15 20:33 ` Clément Pit-Claudel
  2017-10-17 12:07 ` Damien Cassou
@ 2020-09-02 23:15 ` Nick H
  2020-09-03 10:19   ` Stefan Kangas
  2 siblings, 1 reply; 16+ messages in thread
From: Nick H @ 2020-09-02 23:15 UTC (permalink / raw)
  To: stefan; +Cc: Damien Cassou, Clément Pit-Claudel, 26525


> I'm marking this bug as unreproducible for now.  Please report back
> if you see this again or can provide any more information.

I just bumped into this bug on 27.1 with the same symptoms - typing lag
after activating flyspell-mode. 

I took a couple of profiles - the first when lag was apparent and
another after clearing the lag by toggling flyspell-mode.

Both profiles show a similar result, so the "high cpu" in sit-for might
be a red-herring.

Profile 1 - with lag
  - flyspell-post-command-hook                     1146  92%
   - flyspell-check-word-p                         1120  90%
    - sit-for                                      1117  90%
     - redisplay                                    551  44%
      + redisplay_internal (C function)               1   0%
       read-event                                   390  31%
    - flyspell-get-not-casechars                      1   0%
       ispell-get-decoded-string                      1   0%
   + flyspell-word                                    8   0%
   + flyspell-check-pre-word-p                        3   0%
  + command-execute                                  65   5%
  + ...                                              22   1%
  + undo-auto--add-boundary                           1   0%

Profile 2 - without lag
  - flyspell-post-command-hook                     3507  94%
   - flyspell-check-word-p                         3432  92%
    - sit-for                                      3414  92%
     - redisplay                                   1660  44%
      + redisplay_internal (C function)               3   0%
     + read-event                                  1317  35%
    + ispell-get-otherchars                           6   0%
    + flyspell-get-not-casechars                      5   0%
   + flyspell-word                                   17   0%
   + flyspell-check-pre-word-p                       13   0%
  + command-execute                                  93   2%
  + ...                                              87   2%
  + timer-event-handler                               3   0%
    undo-auto--add-boundary                           2   0%
    tooltip-hide                                      1   0%

Nick






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2020-09-02 23:15 ` Nick H
@ 2020-09-03 10:19   ` Stefan Kangas
  2020-09-04  1:01     ` Nick Helm
  0 siblings, 1 reply; 16+ messages in thread
From: Stefan Kangas @ 2020-09-03 10:19 UTC (permalink / raw)
  To: Nick H; +Cc: Damien Cassou, Clément Pit-Claudel, 26525

Nick H <nick@tenpoint.co.nz> writes:

> I just bumped into this bug on 27.1 with the same symptoms - typing lag
> after activating flyspell-mode.

What is your ispell/flyspell configuration?

Do you have any ideas about how to reproduce it, or could you say
something about the circumstances under which you saw this?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU
  2020-09-03 10:19   ` Stefan Kangas
@ 2020-09-04  1:01     ` Nick Helm
  0 siblings, 0 replies; 16+ messages in thread
From: Nick Helm @ 2020-09-04  1:01 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 26525

On Thu, 2020-09-03 at 03:19 -0700, Stefan Kangas wrote:
> Nick H <nick@tenpoint.co.nz> writes:
> 
> > I just bumped into this bug on 27.1 with the same symptoms - typing
> > lag after activating flyspell-mode.
> 
> What is your ispell/flyspell configuration?

Nothing unusual:

grep -C2 -E \(ispell\|flyspell\) ~/.config/emacs/init.el

  ; spelling
  (setq ispell-choices-win-default-height 2)
  (setq ispell-dictionary "en_NZ")
  (setq ispell-personal-dictionary (concat nh-etc "hunspell-dict"))
  (setq ispell-program-name "hunspell")
  (setq ispell-dictionary-alist
        '(("en_NZ" "[[:alpha:]]" "[^[:alpha:]]" "[']" t nil t utf-8)))
  (with-eval-after-load 'flyspell
    (progn
      (define-key 
         flyspell-mouse-map [down-mouse-3] #'flyspell-correct-word)
      (define-key 
         flyspell-mouse-map [mouse-3] nil)))

> Do you have any ideas about how to reproduce it, or could you say
> something about the circumstances under which you saw this?

The lead-up was pretty mundane - I visited an elisp file, set the 
region to a block of text, M-x write-region, C-x C-f the resulting
file, M-x vi-l-m, a few edits, M-x flys-buf, M-x flys-mod --> lag

I tried to reproduce the problem, but no success. Sorry.







^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-09-04  1:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-15 20:28 bug#26525: `sit-for' in Flyspell slows typing down, hogs 90% of CPU Clément Pit-Claudel
2017-04-15 20:33 ` Clément Pit-Claudel
2017-04-17  7:14   ` Eli Zaretskii
2017-04-17 13:29     ` Clément Pit-Claudel
2017-04-17 14:25       ` Eli Zaretskii
2017-04-17 15:36         ` Clément Pit-Claudel
2020-08-13  1:41           ` Stefan Kangas
2017-10-17 12:07 ` Damien Cassou
2020-08-28 11:49   ` Stefan Kangas
2020-08-28 12:35     ` Damien Cassou
2020-08-28 18:40       ` Clément Pit-Claudel
2020-08-29 16:27         ` Stefan Kangas
2020-08-29 18:10           ` Clément Pit-Claudel
2020-09-02 23:15 ` Nick H
2020-09-03 10:19   ` Stefan Kangas
2020-09-04  1:01     ` Nick Helm

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).