unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Help debugging elisp and emacs display engine
@ 2015-11-26 23:35 Cody Goodman
  2015-11-27  4:32 ` Noam Postavsky
  2015-11-27  4:51 ` John Mastro
  0 siblings, 2 replies; 3+ messages in thread
From: Cody Goodman @ 2015-11-26 23:35 UTC (permalink / raw)
  To: emacs-devel

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

I'm trying to debug emacs scrolling issues in long files, this elisp[0]
doesn't seem to benchmark the redrawing or slownesses and claims "Elapsed
time: 0.000003s". I'm guessing this is because of the problem residing in
the display engine that is written in C?

I'm also trying to follow how scroll-up-command passes values or sends
arguments to the display engine so I know where to start profiling it and
digging deeper into this problem.

When I get the following cpu report, it's not clear where/how the display
engine is called:

- command-execute                                                3526  99%
 - call-interactively                                            3526  99%
  - funcall-interactively                                        3147  88%
   - scroll-up-command                                           2900  81%
    - apply                                                      2900  81%
     - #<compiled 0x8db10b>                                      2900  81%
      - apply                                                    2896  81%
         #<compiled 0x22d001>                                    2896  81%

How do I begin to debug these compiled functions? How do I trace the
context/variables that apply might send to the display engine?

Thanks in advance for any help.


0: elisp code
(defun test-long-line-scrolling (n)
  (with-selected-window (get-buffer-window "long-lines-file-test-emacs.txt")
    (goto-char (point-max))
    (dolist '(number-sequence 0 n)
      (scroll-down))))

;; TODO: lookup how benchmark works
(benchmark 10 (test-long-line-scrolling 100))

[-- Attachment #2: Type: text/html, Size: 2156 bytes --]

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

* Re: Help debugging elisp and emacs display engine
  2015-11-26 23:35 Help debugging elisp and emacs display engine Cody Goodman
@ 2015-11-27  4:32 ` Noam Postavsky
  2015-11-27  4:51 ` John Mastro
  1 sibling, 0 replies; 3+ messages in thread
From: Noam Postavsky @ 2015-11-27  4:32 UTC (permalink / raw)
  To: Cody Goodman; +Cc: emacs-devel

On Thu, Nov 26, 2015 at 6:35 PM, Cody Goodman
<codygman.consulting@gmail.com> wrote:
> ;; TODO: lookup how benchmark works
> (benchmark 10 (test-long-line-scrolling 100))

You need to quote the form you want to measure:

(benchmark 10 '(test-long-line-scrolling 100))

This seems to have come up several times in the last couple of weeks.
Maybe `benchmark' should issue a warning if the FORM argument
satisfies `atom'?



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

* Re: Help debugging elisp and emacs display engine
  2015-11-26 23:35 Help debugging elisp and emacs display engine Cody Goodman
  2015-11-27  4:32 ` Noam Postavsky
@ 2015-11-27  4:51 ` John Mastro
  1 sibling, 0 replies; 3+ messages in thread
From: John Mastro @ 2015-11-27  4:51 UTC (permalink / raw)
  To: emacs-devel; +Cc: Cody Goodman


> (defun test-long-line-scrolling (n)
>   (with-selected-window (get-buffer-window "long-lines-file-test-emacs.txt")
>     (goto-char (point-max))
>     (dolist '(number-sequence 0 n)
>       (scroll-down))))
> 
> ;; TODO: lookup how benchmark works
> (benchmark 10 (test-long-line-scrolling 100))

In addition to what Noam said, you seem to be misusing `dolist'. 

Try (dolist (_ (number-sequence 0 n)) ...)

Or, better, (dotimes (_ n) ...)

-- 
john


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

end of thread, other threads:[~2015-11-27  4:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-26 23:35 Help debugging elisp and emacs display engine Cody Goodman
2015-11-27  4:32 ` Noam Postavsky
2015-11-27  4:51 ` John Mastro

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