unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Aaron Jensen <aaronjensen@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Alan Third <alan@idiocy.org>, emacs-devel@gnu.org
Subject: Re: macOS metal rendering engine in mac port
Date: Sat, 29 May 2021 11:22:06 -0700	[thread overview]
Message-ID: <CAHyO48zbpu-JeccmqTjY5b02_t469B7Vvb8n_RupiSGLwbPfEg@mail.gmail.com> (raw)
In-Reply-To: <83a6od5tqh.fsf@gnu.org>

On Sat, May 29, 2021 at 10:34 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Aaron Jensen <aaronjensen@gmail.com>
> > Date: Sat, 29 May 2021 10:05:51 -0700
> > Cc: Alan Third <alan@idiocy.org>, emacs-devel@gnu.org
> >
> > On Sat, May 29, 2021 at 9:49 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > >
> > > > From: Aaron Jensen <aaronjensen@gmail.com>
> > > > Date: Sat, 29 May 2021 09:18:07 -0700
> > > >
> > > > On Sat, May 29, 2021 at 2:21 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > > > >
> > > > > Compared to what latency without line numbers?  60-80ms is quite a lot
> > > > > for redisplay, but I don't really have a clear picture of how that
> > > > > works on NS.
> > > >
> > > > Often around 90-100ms.
> > >
> > > I don't understand: you get 60-80ms _with_ line numbers and 90-100ms
> > > _without_ line numbers?  That's the opposite of what I would expect.
> >
> > Ugh, my reading comprehension is off this morning. That was the
> > without _patch_ timing I shared. Turning off line numbers when the
> > patch is enabled likely won't make a difference. I can't measure that
> > right now.
>
> I think we might be mis-communicating.  You said:
>
> > Oh, and even with my config, with line numbers, in a ruby file, I'm
> > seeing 60-80ms latency with my measuring app. That's quite a bit
> > better.
>
> (Was this with or without the hash patch applied?)

It was with the patch. I was primarily reporting that for Alan's
benefit as he and I had been discussing those latency numbers.

> In response I asked:
>
> > Compared to what latency without line numbers?  60-80ms is quite a lot
> > for redisplay, but I don't really have a clear picture of how that
> > works on NS.
>
> I wanted to know the latency _without_ line numbers in the same setup
> where with line numbers you see 60-80ms.  I'm not sure what you wrote
> above answers that question.

I didn't, because I hadn't measured it yet. I just measured it and
it's very similar. This measurement technique is very imprecise, so I
have to take several measurements. I can't measure a difference
between line numbers and not when the hash patch is applied.

> > > > As I've described earlier in this thread, turning on line numbers
> > > > massively increases the number of calls to
> > > > lface_from_face_name_no_resolve
> > >
> > > And as I've explained to you, "massively" is an exaggeration.  The
> > > number of face merges increases roughly two-fold when you turn on line
> > > numbers.
> >
> > 4.5x more calls to lface_from_face_name_no_resolve. Exaggeration or
> > not, it's significant.
>
> Its being significant is what surprises me.  The linear search in
> assq_no_quit should be very fast, as it requires just a few machine
> instructions per member.  You yourself say your profile says it takes
> 15ms to call that function 500k times.  How can extra 15ms be so
> significant?

I did not say this. 500k times, according to the benchmarks I
provided, take over 2s. It's only 15ms to do 500k _hash lookups_.

> > It's reversed, but you can see 15ms spent in assq_no_quit. For some
> > reason, that's enough to put it right over the edge of what I can feel
> > when I type.
>
> I don't understand this.  I think there's some other factor at work
> here.
>
> Is it possible that many of the 1200 faces you have inherit from other
> faces, perhaps recursively?

My theme is set up like this:
https://github.com/aaronjensen/nano-emacs/blob/master/nano-theme.el

I don't know if I'm doing something wrong in there, I copied it from
the nano project. I know it's atypical to not use a theme.

> > > > I'm really not seeing anything mysterious about this, but I don't have
> > > > the context you have so I could be missing something. It looks like a
> > > > case of O(N) scales worse than O(log n). I just happen to have an N
> > > > that is 10x the N with emacs -Q.
> > >
> > > Linear search should be linear in the number of faces in the list.
> >
> > Well, to be precise, it's linear in the position of the thing found,
> > which is relevant when most of the calls are for the same 2 elements.
>
> But if these faces are always at the same place near the end of the
> list, then adding more faces should indeed produce a linear effect,
> right?

Yes, a linear effect compounded by a large number of calls. That said,
it looks like the effect is 2x what I'd expect given the difference
between face counts. So yes, there may be something else at play. I'd
have to actually put a count in assq_no_quit to see if it's being
called more times than I'd expect.

About perceiving typing latency, have you read this article:
https://pavelfatin.com/typing-with-pleasure/

It's what finally helped me understand what I was perceiving many years ago.

Aaron



  reply	other threads:[~2021-05-29 18:22 UTC|newest]

Thread overview: 155+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  1:17 macOS metal rendering engine in mac port Aaron Jensen
2021-05-21  6:07 ` Eli Zaretskii
2021-05-21  6:13   ` Aaron Jensen
2021-05-21  7:35 ` Alan Third
2021-05-21 15:27   ` Aaron Jensen
2021-05-21 17:39     ` Alan Third
     [not found]       ` <CAHyO48ys2sYxbZuho1NutqNAM-z0tTaKwuR1TxUuhMZG5XJ0aA@mail.gmail.com>
2021-05-22 16:01         ` Aaron Jensen
2021-05-22 16:30           ` Eli Zaretskii
2021-05-22 16:46             ` Eli Zaretskii
2021-05-22 17:00               ` Eli Zaretskii
2021-05-22 18:44         ` Alan Third
2021-05-22 18:59           ` Aaron Jensen
2021-05-22 19:57             ` Alan Third
2021-05-22 21:20               ` Aaron Jensen
2021-05-23 11:47                 ` Alan Third
2021-05-23 16:09                   ` Stefan Monnier
2021-05-23 16:13                   ` Aaron Jensen
2021-05-23 17:06                     ` Aaron Jensen
2021-05-23 17:21                       ` Eli Zaretskii
2021-05-23 18:38                         ` Aaron Jensen
2021-05-23 18:48                           ` Eli Zaretskii
2021-05-23 19:49                             ` Aaron Jensen
2021-05-24  0:00                           ` Aaron Jensen
2021-05-24  0:04                             ` Aaron Jensen
     [not found]                               ` <CAHyO48z1m5aeqwqmZds3yuYiJ=rdHZ79JPVyuh1kHVU0Rw47EA@mail.gmail.com>
2021-05-24  6:51                                 ` Aaron Jensen
2021-05-24  7:37                                   ` Eli Zaretskii
2021-05-24  8:07                                     ` Aaron Jensen
2021-05-24  8:48                                       ` Eli Zaretskii
2021-05-24 15:32                                         ` Aaron Jensen
2021-05-24 16:28                                           ` Eli Zaretskii
2021-05-24 16:31                                             ` Aaron Jensen
2021-05-24 16:43                                               ` Eli Zaretskii
2021-05-24 17:58                                                 ` Aaron Jensen
2021-05-24 18:03                                                   ` Eli Zaretskii
2021-05-24 18:16                                                     ` Alan Third
2021-05-24 18:18                                                     ` Aaron Jensen
2021-05-24 18:54                                                       ` Eli Zaretskii
2021-05-24 19:07                                                         ` Aaron Jensen
2021-05-24 19:21                                                           ` Eli Zaretskii
2021-05-24 19:27                                                             ` Eli Zaretskii
2021-05-24 20:21                                                               ` Aaron Jensen
2021-05-25  2:31                                                                 ` Eli Zaretskii
     [not found]                                                                   ` <CAHyO48yxxdURvZSzrWn-F+6wKwHgpwcoXD7_w0NmWLcfBKkUkw@mail.gmail.com>
2021-05-25  5:41                                                                     ` Eli Zaretskii
2021-05-25  6:26                                                                       ` Aaron Jensen
2021-05-25 12:16                                                                         ` Eli Zaretskii
2021-05-25 12:23                                                                           ` Alan Third
2021-05-25 12:56                                                                           ` Alan Third
2021-05-25 13:00                                                                             ` Eli Zaretskii
2021-05-25 13:07                                                                               ` Alan Third
2021-05-25 13:18                                                                                 ` Eli Zaretskii
2021-05-25 13:34                                                                                   ` Alan Third
2021-05-25 13:47                                                                                     ` Eli Zaretskii
2021-05-25 13:50                                                                                       ` Alan Third
2021-05-27 16:55                                                                             ` Eli Zaretskii
2021-05-27 17:40                                                                               ` Alan Third
2021-05-27 17:47                                                                                 ` Eli Zaretskii
2021-05-27 17:51                                                                                   ` Alan Third
2021-05-27 17:53                                                                                     ` Aaron Jensen
2021-05-27 18:59                                                                                       ` Eli Zaretskii
2021-05-27 19:02                                                                                         ` Aaron Jensen
2021-05-27 19:22                                                                                           ` Eli Zaretskii
2021-05-27 19:37                                                                                             ` Aaron Jensen
2021-05-28 17:58                                                                                               ` Eli Zaretskii
2021-05-28 18:21                                                                                                 ` Aaron Jensen
2021-05-28 19:00                                                                                                   ` Eli Zaretskii
2021-05-25 15:35                                                                           ` Aaron Jensen
2021-05-25 17:34                                                                             ` Eli Zaretskii
2021-05-25 17:48                                                                               ` Aaron Jensen
2021-05-25  9:01                                                                     ` Alan Third
2021-05-24 12:47                                 ` Eli Zaretskii
2021-05-24 16:10                                   ` Aaron Jensen
2021-05-23 21:20                       ` Alan Third
2021-05-23 22:04                         ` Alan Third
2021-05-23 22:12                           ` Alan Third
2021-05-23 21:08                     ` Alan Third
2021-05-23 22:37                       ` Aaron Jensen
2021-05-24  9:01                         ` Alan Third
2021-05-25 16:31                           ` Aaron Jensen
2021-05-26  0:32                             ` Aaron Jensen
2021-05-26  6:23                               ` Alan Third
2021-05-26  6:26                                 ` Aaron Jensen
2021-05-26  7:35                                   ` Aaron Jensen
2021-05-28 17:39                                 ` Aaron Jensen
2021-05-28 18:32                                   ` Alan Third
2021-05-28 19:00                                     ` Aaron Jensen
2021-05-28 19:29                                       ` Alan Third
2021-05-28 22:07                                         ` Aaron Jensen
2021-05-29  6:07                                           ` Eli Zaretskii
2021-05-29  7:01                                             ` Aaron Jensen
2021-05-29  7:05                                               ` Eli Zaretskii
2021-05-29  8:52                                                 ` Aaron Jensen
2021-05-29  9:06                                                   ` Aaron Jensen
2021-05-29  9:21                                                     ` Eli Zaretskii
2021-05-29  9:35                                                       ` Alan Third
2021-05-29  9:41                                                         ` Eli Zaretskii
2021-05-29 16:18                                                         ` Aaron Jensen
2021-05-29 16:49                                                           ` Eli Zaretskii
2021-05-29 17:05                                                             ` Aaron Jensen
2021-05-29 17:20                                                               ` Aaron Jensen
2021-05-29 17:43                                                                 ` Eli Zaretskii
2021-05-29 18:00                                                                   ` Dmitry Gutov
2021-05-29 18:15                                                                     ` Eli Zaretskii
2021-05-29 18:52                                                                       ` Dmitry Gutov
2021-05-29 19:06                                                                       ` Stefan Monnier
2021-05-29 19:10                                                                         ` Eli Zaretskii
2021-05-29 17:34                                                               ` Eli Zaretskii
2021-05-29 18:22                                                                 ` Aaron Jensen [this message]
2021-05-29 18:27                                                                   ` Aaron Jensen
2021-05-29 18:40                                                                   ` Eli Zaretskii
2021-05-29 19:30                                                                     ` Aaron Jensen
2021-05-29 20:03                                                                       ` Eli Zaretskii
2021-05-29 21:03                                                                         ` Aaron Jensen
2021-05-29 21:05                                                                           ` Aaron Jensen
2021-05-29 21:40                                                                             ` Aaron Jensen
2021-05-30  4:44                                                                               ` Aaron Jensen
2021-05-30  7:01                                                                                 ` Eli Zaretskii
2021-05-30  6:27                                                                               ` Eli Zaretskii
2021-05-30  7:04                                                                                 ` Aaron Jensen
2021-05-30  9:36                                                                                   ` Eli Zaretskii
2021-05-30 15:46                                                                                     ` Aaron Jensen
2021-05-30 16:03                                                                                       ` Eli Zaretskii
2021-05-30 16:16                                                                                         ` Aaron Jensen
2021-05-30 16:35                                                                                           ` Eli Zaretskii
2021-05-30 17:00                                                                                             ` Aaron Jensen
2021-05-30 17:18                                                                                               ` Eli Zaretskii
2021-05-30 23:59                                                                                                 ` Aaron Jensen
2021-05-31  2:28                                                                                                   ` Eli Zaretskii
2021-05-31  2:30                                                                                                     ` Aaron Jensen
2021-06-03 21:42                                                                                                       ` Alan Third
2021-06-03 21:43                                                                                                         ` Aaron Jensen
2021-09-15 13:16                                                                                                         ` Aaron Jensen
2021-09-15 19:30                                                                                                           ` Illia Ostapyshyn
2021-09-15 19:54                                                                                                             ` Alan Third
2021-09-16 15:59                                                                                                               ` Y. E. via Emacs development discussions.
2021-09-17 17:31                                                                                                                 ` Alan Third
2021-09-17 17:43                                                                                                                   ` Aaron Jensen
2021-09-18  5:42                                                                                                                   ` Y. E. via Emacs development discussions.
2021-09-20 21:22                                                                                                                   ` Illia Ostapyshyn
2021-09-21  7:22                                                                                                                     ` Y. E. via Emacs development discussions.
2021-09-21 18:48                                                                                                                       ` Alan Third
2021-09-27 10:07                                                                                                                         ` Alan Third
2021-10-04 14:58                                                                                                                           ` Aaron Jensen
2021-10-25 19:39                                                                                                                           ` Illia Ostapyshyn
2021-10-26 12:16                                                                                                                             ` Alan Third
2021-10-26 13:26                                                                                                                               ` Aaron Jensen
2021-09-16 10:01                                                                                                           ` Rudolf Adamkovič
2021-05-30  6:22                                                                           ` Eli Zaretskii
2021-05-29  9:12                                                   ` Alan Third
2021-05-29  9:26                                                     ` Eli Zaretskii
2021-05-29  9:32                                                       ` Alan Third
2021-05-29  9:37                                                         ` Eli Zaretskii
2021-05-29  9:39                                                           ` Eli Zaretskii
2021-05-29  9:44                                                             ` Alan Third
2021-05-29 14:12                                                             ` Alan Third
2021-05-23 23:32                       ` Tim Cross

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=CAHyO48zbpu-JeccmqTjY5b02_t469B7Vvb8n_RupiSGLwbPfEg@mail.gmail.com \
    --to=aaronjensen@gmail.com \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    --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 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).