[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reliable after-change-functions (via: Using incremental parsing in E
From: |
Eli Zaretskii |
Subject: |
Re: Reliable after-change-functions (via: Using incremental parsing in Emacs) |
Date: |
Wed, 01 Apr 2020 18:59:31 +0300 |
> Cc: address@hidden, address@hidden, address@hidden,
> address@hidden
> From: Dmitry Gutov <address@hidden>
> Date: Wed, 1 Apr 2020 18:16:04 +0300
>
> > I see a very different picture here: the above takes something like
> > 15%. Most of the time is spent in functions called by jit-lock.
>
> What are your measurements, though?
My full profile is below. This is from Emacs 27.0.90 compiled with
the -Og optimization and with wide-int (which slows down Emacs by
about 30%).
> Again, what does this print out?
>
> (benchmark 1 '(progn (find-file "src/xdisp.c")))
Elapsed time: 1.733853s (0.140584s in 6 GCs)
> No 'goto-char'. As we've established, it only affects the time taken by
> redisplay, and I can't measure that. So I'm not profiling it either,
> otherwise I'd be comparing apples to oranges.
See the second profile below.
> Yes. The numbers can be different, but there is definitely some up-front
> computation there. One that's not present with e.g. js-mode.
So you are saying that we should do that up-front computation just
because CC mode currently does it? That we shouldn't try to eliminate
such preprocessing? I don't think so.
Here's the profile from visiting xdisp.c and going to end of the
buffer:
- redisplay_internal (C function) 65 41%
- jit-lock-function 65 41%
- jit-lock-fontify-now 65 41%
- jit-lock--run-functions 65 41%
- run-hook-wrapped 65 41%
- #<compiled -0x1ffffffff8adaa88> 65 41%
- font-lock-fontify-region 65 41%
- c-font-lock-fontify-region 65 41%
- font-lock-default-fontify-region 50 31%
- font-lock-fontify-keywords-region 35 22%
- c-font-lock-declarations 34 21%
- c-find-decl-spots 34 21%
- c-bs-at-toplevel-p 32 20%
- c-brace-stack-at 32 20%
- c-update-brace-stack 31 19%
- c-syntactic-re-search-forward 27 17%
- c-beginning-of-macro 6 3%
back-to-indentation 2 1%
#<compiled -0x1ffffffff8ae5f98> 1 0%
c-forward-sws 1 0%
- c-font-lock-complex-decl-prepare 1 0%
- c-parse-state 1 0%
- c-parse-state-1 1 0%
- c-parse-state-get-strategy 1 0%
- c-get-fallback-scan-pos 1 0%
- beginning-of-defun 1 0%
- beginning-of-defun-raw 1 0%
syntax-ppss 1 0%
- font-lock-fontify-syntactically-region 15 9%
syntax-ppss 15 9%
- c-before-context-fl-expand-region 15 9%
- mapc 15 9%
- #<compiled -0x1ffffffff8a66198> 15 9%
- c-context-expand-fl-region 15 9%
- c-fl-decl-start 15 9%
- c-literal-start 14 8%
- c-semi-pp-to-literal 14 8%
c-parse-ps-state-below 14 8%
c-determine-limit 1 0%
- command-execute 64 40%
- call-interactively 64 40%
- funcall-interactively 63 40%
- eval-last-sexp 63 40%
- elisp--eval-last-sexp 63 40%
- eval 63 40%
- progn 63 40%
- progn 63 40%
- find-file 63 40%
- find-file-noselect 63 40%
- find-file-noselect-1 63 40%
- after-find-file 63 40%
- normal-mode 61 38%
- set-auto-mode 61 38%
- set-auto-mode-0 61 38%
- c-mode 61 38%
- c-common-init 57 36%
- mapc 57 36%
- #<compiled -0x1ffffffff8a7d680> 37 23%
- c-neutralize-syntax-in-CPP 20 12%
- c-beginning-of-macro 4 2%
c-backward-single-comment 2 1%
back-to-indentation 1 0%
c-no-comment-end-of-macro 3 1%
c-after-change-mark-abnormal-strings 15
9%
c-parse-quotes-after-change 1 0%
- #<compiled -0x1ffffffff8a7d6b0> 20 12%
- c-before-change-check-unbalanced-strings
15 9%
- c-literal-limits 15 9%
- c-full-pp-to-literal 15 9%
c-parse-ps-state-below 15 9%
c-depropertize-CPP 4 2%
- byte-code 2 1%
require 1 0%
- run-mode-hooks 1 0%
- hack-local-variables 1 0%
- hack-dir-local-variables 1 0%
dir-locals-read-from-dir 1 0%
- run-hooks 2 1%
- vc-refresh-state 2 1%
- vc-backend 2 1%
- vc-registered 2 1%
- mapc 2 1%
- #<compiled -0x1ffffffff8a67780> 2 1%
- vc-call-backend 2 1%
- apply 2 1%
- vc-git-registered 2 1%
- if 2 1%
- progn 2 1%
- load 1 0%
require 1 0%
- byte-code 1 0%
- read-extended-command 1 0%
- completing-read 1 0%
completing-read-default 1 0%
- ... 28 17%
Automatic GC 27 17%
- substitute-key-definition-key 1 0%
- substitute-key-definition 1 0%
- map-keymap 1 0%
- #<compiled -0x1ffffffff8a80eb8> 1 0%
- substitute-key-definition-key 1 0%
- substitute-key-definition 1 0%
- map-keymap 1 0%
- #<compiled -0x1ffffffff8a80c48> 1 0%
- substitute-key-definition-key 1 0%
- substitute-key-definition 1 0%
- map-keymap 1 0%
- #<compiled -0x1ffffffff8a80658> 1 0%
- substitute-key-definition-key 1 0%
- substitute-key-definition 1 0%
- map-keymap 1 0%
#<compiled -0x1ffffffff8a7ce58> 1 0%
Here's the profile from just visiting xdisp.c:
- command-execute 67 82%
- call-interactively 67 82%
- funcall-interactively 67 82%
- eval-expression 67 82%
- eval 67 82%
- progn 67 82%
- find-file 67 82%
- find-file-noselect 67 82%
- find-file-noselect-1 66 81%
- after-find-file 66 81%
- normal-mode 62 76%
- set-auto-mode 62 76%
- set-auto-mode-0 62 76%
- c-mode 62 76%
- c-common-init 55 67%
- mapc 55 67%
- #<compiled -0x1ffffffff8aa7940> 36 44%
- c-neutralize-syntax-in-CPP 21 25%
- c-beginning-of-macro 2 2%
c-backward-single-comment 1 1%
c-after-change-mark-abnormal-strings 14 17%
- #<compiled -0x1ffffffff8aa7970> 19 23%
- c-before-change-check-unbalanced-strings 14
17%
- c-literal-limits 14 17%
- c-full-pp-to-literal 14 17%
c-parse-ps-state-below 14 17%
- c-depropertize-CPP 4 4%
c-end-of-macro 1 1%
- byte-code 6 7%
require 4 4%
- substitute-key-definition 1 1%
- map-keymap 1 1%
- #<compiled -0x1ffffffff8aac0b8> 1 1%
- substitute-key-definition-key 1 1%
- substitute-key-definition 1 1%
map-keymap 1 1%
- run-hooks 4 4%
- vc-refresh-state 4 4%
- vc-backend 4 4%
- vc-registered 4 4%
- mapc 3 3%
- #<compiled -0x1ffffffff8ae8e88> 3 3%
- vc-call-backend 3 3%
- apply 3 3%
- vc-git-registered 2 2%
- if 2 2%
- progn 2 2%
- load 1 1%
- require 1 1%
- defconst 1 1%
byte-code 1 1%
- vc-git-registered 1 1%
- vc-git--out-ok 1 1%
- apply 1 1%
- vc-git--call 1 1%
- apply 1 1%
- process-file 1 1%
apply 1 1%
- vc-git-find-file-hook 1 1%
- vc-state 1 1%
- vc-state-refresh 1 1%
- vc-call-backend 1 1%
- apply 1 1%
- vc-git-state 1 1%
- apply 1 1%
- vc-git--run-command-string 1 1%
- apply 1 1%
- vc-git--out-ok 1 1%
- apply 1 1%
- vc-git--call 1 1%
- apply 1 1%
- process-file 1 1%
apply 1 1%
vc-file-getprop 1 1%
- find-buffer-visiting 1 1%
- file-truename 1 1%
- file-truename 1 1%
- file-truename 1 1%
- file-truename 1 1%
- file-truename 1 1%
file-truename 1 1%
- ... 14 17%
Automatic GC 14 17%
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Eli Zaretskii, 2020/04/01
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Dmitry Gutov, 2020/04/01
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Eli Zaretskii, 2020/04/01
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Eli Zaretskii, 2020/04/01
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Dmitry Gutov, 2020/04/01
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs),
Eli Zaretskii <=
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Dmitry Gutov, 2020/04/01
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Stefan Monnier, 2020/04/01
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Eli Zaretskii, 2020/04/02
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Dmitry Gutov, 2020/04/02
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Eli Zaretskii, 2020/04/02
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Tuấn-Anh Nguyễn, 2020/04/03
- Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Dmitry Gutov, 2020/04/03
Re: Reliable after-change-functions (via: Using incremental parsing in Emacs), Alan Mackenzie, 2020/04/01