all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: dmantipov@yandex.ru
Cc: emacs-devel@gnu.org
Subject: Re: Long lines and bidi
Date: Fri, 08 Feb 2013 16:46:13 +0200	[thread overview]
Message-ID: <836222983u.fsf@gnu.org> (raw)
In-Reply-To: <838v6y99wk.fsf@gnu.org>

> Date: Fri, 08 Feb 2013 16:07:23 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> Profile alone is not enough.  Please tell how did you "scroll",
> exactly (which commands did you use), and please also show the
> absolute times it took to perform each command.

Btw, if you are serious about finding a solution to the long-line
display misfeature (or any other too-slow redisplay situation), I
generally find it necessary to do precision timing of the suspicious
parts of code, because otherwise it is impossible to find the actual
culprits.  On GNU/Linux, I use the following simple function:

  double
  timer_time (void)
  {
    struct timeval tv;

    gettimeofday (&tv, NULL);
    return tv.tv_usec * 0.000001 + tv.tv_sec;
  }

Now, to time a particular portion of the code, do something like this:

  double t1, t2;
  ...
  t1 = timer_time ();
  /* here comes the code that should be timed */
  t2 = timer_time ();
  if (t2 - t1 > THRESHOLD)
    fprintf (stderr, "that code took %.4g sec\n", t2 - t1);

The value of THRESHOLD depends on the magnitude of the slow-down you
are working on.  I generally start with 0.1 of the time it takes to
perform some redisplay operation; e.g., if it takes 5 sec to move the
cursor, start with 0.5 sec.  gettimeofday has a sufficient resolution
on GNU/Linux to get you sub-millisecond accuracy, which is more than
enough for display engine measurements.

Using the above, you can quickly identify the function(s) that take
most of the time of a particular redisplay operation, then time the
parts of those functions to find the most expensive parts, and so on,
recursively, until you find the hot spots (more than 50% of the slow
operation).



  reply	other threads:[~2013-02-08 14:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-03 22:05 bug#13623: 24.3.50; Redisplay issue with transient-mark-mode Lawrence Mitchell
2013-02-04 15:49 ` Eli Zaretskii
2013-02-04 17:20   ` Lawrence Mitchell
2013-02-04 18:10     ` Eli Zaretskii
2013-02-05  4:54   ` Dmitry Antipov
2013-02-05 12:07     ` Dmitry Antipov
2013-02-05 17:46       ` Eli Zaretskii
2013-02-05 17:45     ` Eli Zaretskii
2013-02-06  7:16       ` Dmitry Antipov
2013-02-06 14:31         ` Stefan Monnier
2013-02-06 15:14           ` Dmitry Antipov
2013-02-06 18:04             ` Eli Zaretskii
2013-02-06 18:23             ` Eli Zaretskii
2013-02-06 20:30               ` Stefan Monnier
2013-02-07  3:41                 ` Eli Zaretskii
2013-02-08 13:33               ` Long lines and bidi [Was: Re: bug#13623: ...] Dmitry Antipov
2013-02-08 14:07                 ` Eli Zaretskii
2013-02-08 14:46                   ` Eli Zaretskii [this message]
2013-02-08 16:38                     ` Long lines and bidi Dmitry Antipov
2013-02-08 16:52                       ` Eli Zaretskii
2013-02-09  3:34                         ` Paul Eggert
2013-02-09  8:46                           ` Eli Zaretskii
2013-02-09  9:05                             ` Paul Eggert
2013-02-09  9:33                               ` Eli Zaretskii
2013-02-11  2:33                                 ` Paul Eggert
2013-02-09 10:01                               ` Eli Zaretskii
2013-02-10 16:57                                 ` Eli Zaretskii
2013-02-11  5:43                                   ` Dmitry Antipov
2013-02-11  7:54                                     ` Dmitry Antipov
2013-02-11 16:47                                       ` Eli Zaretskii
2013-02-11 23:55                                         ` Paul Eggert
2013-02-11 16:42                                     ` Eli Zaretskii
2013-02-11 17:53                                       ` Dmitry Antipov
2013-02-11 18:10                                         ` Eli Zaretskii
2013-02-11 18:21                                           ` Dmitry Antipov
2013-02-11 17:17                                   ` Eli Zaretskii
2013-02-11 17:55                                     ` Drew Adams
2013-02-11 18:13                                       ` Eli Zaretskii
2013-02-08 16:21                   ` Long lines and bidi [Was: Re: bug#13623: ...] Dmitry Antipov
2013-02-08 17:04                     ` Eli Zaretskii
2013-02-08 15:33                 ` Stefan Monnier
2013-02-08 16:05                   ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=836222983u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.