> Date: Tue, 03 Sep 2024 16:36:44 +0100 > From: "Stephane Travostino" <s...@combo.cc> > Cc: 72...@debbugs.gnu.org > > > Please try profiling the lagging cases with "M-x profiler", and post > > the profile here. > > I don't know how to make a consistent test case. I have tried here to profile > opening Emacs (same commit with and without PGTK) on the same 547-line Elixir > file, and holding the Down key until it reaches the bottom and then back to > the top of the buffer. I have (setopt scroll-conservatively 101) so after the > first page the contents are continuously redrawn for every new line. > > The PGTK version feels like it's skipping frames while it's relatively smooth > on X11: > > X11: > 8795 86% + redisplay_internal (C function) > 1141 11% + command-execute > 54 0% + direnv--maybe-update-environment > 49 0% + gcmh-register-idle-gc > 42 0% + winner-save-old-configurations > 20 0% + timer-event-handler > 18 0% + ... > 18 0% + jit-lock--antiblink-post-command > > > PGTK: > 9387 91% + redisplay_internal (C function) > 698 6% + command-execute > 19 0% + ... > 19 0% + timer-event-handler > 12 0% + direnv--maybe-update-environment > 11 0% + winner-save-old-configurations > > I have run this a few times and in Wayland `redisplay_internal` takes always > a few percent more time than on X11, though I am not sure these numbers can > prove anything as they are quite close.
Thanks. Maybe Po Lu will have some ideas. > Is there some kind of consistent UI benchmark I can run? The frame skipping > reminds me of missed vsync deadlines one might experience in games. Try this: (defun scroll-up-benchmark () (interactive) (let ((oldgc gcs-done) (oldtime (float-time))) (condition-case nil (while t (scroll-up) (redisplay)) (error (message "GCs: %d Elapsed time: %f seconds" (- gcs-done oldgc) (- (float-time) oldtime)))))) Evaluate this function, then visit a large file, like src/xdisp.c from the Emacs sources, and invoke "M-x scroll-up-benchmark RET". It will show the time it took at the end. Record the results and compare with the other configuration.