unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: How to measure frame rate in fps?
Date: Tue, 01 Jun 2021 14:43:31 +0300	[thread overview]
Message-ID: <83h7ih24kc.fsf@gnu.org> (raw)
In-Reply-To: <CAKDRQS7bpNPwROH-eufWdBS6xvqYgz5E1ZuiUSej0OMWoMd6Gw@mail.gmail.com> (message from Jimmy Yuen Ho Wong on Mon, 31 May 2021 14:03:17 +0100)

> From: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
> Date: Mon, 31 May 2021 14:03:17 +0100
> 
> I've gotten into a discussion with isort's author about how fast
> editors can actually render text. I was just wondering if there are
> any built-in facilities that can measure framerate in FPS in emacs?

Emacs doesn't work at a fixed "frame rate".  It attempts to optimize
each update of the screen as much as possible, so the actual time to
perform a single update of a window depends on how much stuff on the
screen needs to be changed since the previous redisplay cycle.  As
result, you will find that the redisplay time could vary by a factor
of 10 if not more, depending on what changed in the editor's internal
state.  Moreover, the first phase of redisplay, the one that
determines what needs to be redrawn, might decide to redraw something,
but the second phase, which actually writes to the glass, can decide
that nothing needs to be redrawn.  I don't know how to quantify the
speed of "redrawing" when nothing is actually redrawn, although some
CPU cycles are expended.

That said, you can measure the time it takes to redisplay after some
change using the "M-x benchmark" command to time the function
'redisplay'.  You just need to remember to include some command that
would affect the display, or else redisplay will do very little and
redraw nothing.  For example:

  C-u 100 M-x benchmark RET (progn (scroll-up) (redisplay)) RET

or

  C-u 100 M-x benchmark RET (progn (insert "a") (redisplay)) RET

(The former is better tried in a buffer that has more than 100
screenfuls of text.)

Then subtract the time it takes to run the same benchmark, but without
the "(redisplay)" part, divide the result by 100, and you get the time
it takes to redisplay a single window.



  parent reply	other threads:[~2021-06-01 11:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 13:03 How to measure frame rate in fps? Jimmy Yuen Ho Wong
2021-06-01 10:00 ` Arthur Miller
2021-06-01 11:43 ` Eli Zaretskii [this message]
2021-06-01 14:18   ` Dmitry Gutov
2021-06-01 14:43     ` Eli Zaretskii
2021-06-01 15:00       ` Dmitry Gutov
2021-06-01 15:35         ` Eli Zaretskii
2021-06-01 21:31           ` Dmitry Gutov
2021-06-02  2:29             ` Eli Zaretskii
2021-06-06  2:09               ` Dmitry Gutov
2021-06-06  6:11                 ` Eli Zaretskii
2021-06-06 12:00                   ` Dmitry Gutov
2021-06-06 12:36                     ` Eli Zaretskii
2021-06-06 16:48                       ` Dmitry Gutov
2021-06-06 17:19                         ` Eli Zaretskii
2021-06-06 23:31                           ` Dmitry Gutov
2021-06-07 12:33                             ` Eli Zaretskii
2021-06-06 18:10                         ` Stefan Monnier
2021-06-06 23:35                           ` Dmitry Gutov

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=83h7ih24kc.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=wyuenho@gmail.com \
    /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).