unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Akira Kyle <ak@akirakyle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Rethinking the design of xwidgets
Date: Wed, 14 Oct 2020 12:07:38 -0600	[thread overview]
Message-ID: <86pn5kbs0l.fsf@akirakyle.com> (raw)
In-Reply-To: <83362g27y6.fsf@gnu.org>


On Wed, Oct 14, 2020 at 08:33 AM, Eli Zaretskii <eliz@gnu.org> 
wrote:

>> Can actions be triggered on a click and drag as one would do to 
>> pan within a plot?
>
> I didn't have time to try that, but just looking at the code, I 
> don't
> see anything that makes the clocks on images special, so I'd 
> expect
> the same modifiers and drag-detection code to work.  And if it
> doesn't, I seed no reason why we couldn't teach it to do so.

Good to know.

>> As far as I know there are really only two FLOSS PDF libraries 
>> out 
>> there: poppler and muPDF. Between them poppler supports more 
>> PDF 
>> features and seems to be more widely used. I agree this isn't 
>> really as compelling of a use case for xwidgets, but I seems 
>> like 
>> it would be easier to achieve better PDF rendering via 
>> xwidgets.
>
> I can see how that is tempting: the image handling is taken care 
> of.
> What I'm saying is that this advantage should be carefully 
> weighed
> against the disadvantages and difficulties in integrating such
> self-managing objects into the Emacs display code.

OK. I'm still learning about the redisplay optimizations so 
hopefully I'll have a better idea of what those disadvantages are 
as I play with the existing way xwidgets works with redisplay.

>> > E.g., the kludge in dispnew.c around line 4365.  It disables 
>> > one
>> > of the most important redisplay optimizations in Emacs, once 
>> > you
>> > build with xwidgets enabled.
>> 
>> Ah, I had briefly looked at that but I wasn't sure how 
>> important 
>> it was. I may be able to make some progress on that but it's 
>> hard 
>> to understand the context for that function. It seems like that 
>> function is responsible for an optimization that avoids 
>> redrawing 
>> glyphs if the window is being scrolled by copying them
>
> Not only if the window is scrolled, but also if the previous 
> display
> can be converted into the current display by scrolling some of 
> the
> stuff that is already on the glass.  the algorithm is a basic
> comparison of the current and desired display, similar to what 
> the
> Diff utility does.
>
>> however I couldn't find where or how the glyphs are actually 
>> copied?
>
> See the calls to rif->scroll_run_hook.

Thanks, this helps!

>> I'm just starting to dig my teeth into some of that. However 
>> I'm 
>> wondering if anyone has more recently tried to quantify the 
>> improvements the various redisplay optimizations make to both 
>> actual and perceived render time of Emacs. For example the 
>> comment 
>> on the scrolling_window function in dispnew.c that you pointed 
>> me 
>> too references that it is implementing an algorithm from 1978, 
>> perhaps it would be worth exploring if there are any 
>> algorithmic 
>> advances?
>
> I don't think that algorithm is less optimal nowadays than it 
> was back
> then; the really interesting question is how much it saves us 
> when
> compared to simply redisplaying all those lines.

Yes that is the better question to ask first.

>> It strikes me that perhaps some optimizations may no longer be 
>> as
>> necessary on modern hardware or on GUI displays as they were 
>> when
>> running emacs in a VT on 20 year hardware.
>
> Those are very good questions.  I'm not aware of any such
> investigations since the current redisplay optimizations were
> implemented around 20 years ago: at that time, Gerd Möllmann, 
> who
> developed the current display engine, did add optimizations one 
> by one
> until he got reasonable redisplay performance.
>
> Measuring the speedups from each of the several optimizations is 
> an
> important job, but it's a large job.  For starters, one needs to 
> come
> up with a large enough and representative enough sample of 
> redisplay
> use cases, and that is not easy.  So I'd encourage you (or 
> anyone
> else, actually) to do this important job, but be aware that it 
> could
> take non-trivial time and effort.

I see some redisplay tests in tests/manual/redisplay-testsuite.el 
and scroll-tests.el which seems like it would be a starting point 
for such a study?

>> Conversely there may be further optimization that could be done 
>> by
>> taking advantage of more recent hardware advances such as 
>> offloading
>> to a GPU or utilizing vectorized instructions.
>
> We try not to use machine-dependent code in Emacs, because 
> that's a
> maintenance burden, what with today's fast pace of chip 
> development
> and obsolescence.  Vectorization is generally left to optimizing
> compilers, and relying on special hardware, such as GPU, is not
> something we should depend on directly.  We should instead hope 
> that
> the GUI toolkits and display systems we use will do that for us.

That's more what I meant.

>> If there's one think I've taken away from my CS education, its 
>> that
>> indeed "premature optimization is the root of all evil".
>
> The optimizations we have today were definitely NOT premature 
> when
> they were introduced.  How much they are still needed today is 
> indeed
> an interesting and important question that still awaits the 
> motivated
> investigators.  I have only indirect evidence that some of the
> optimizations still do a useful job: compare the redisplay 
> performance
> when linum-mode is turned on with the performance when the 
> native
> display-line-numbers-mode is used instead.  Also, we frequently 
> hear
> complaints about redisplay performance, even if you take away 
> the
> problems with long lines.

I am a user who frequently wishes redisplay was better which has 
partly motivated my interest in this. Between displaying long org 
mode documents with inline images and long lines of generated 
latex, I'll often see noticeable delay in basic buffer operations 
such as scrolling. This is also exacerbated by the fact that I'm 
doing all of this on a Pinebook Pro which is an arm aarch64 system 
comparable to the raspberry pi. In fact the only way Emacs has 
been generally usable for me on this laptop is with the 
native-comp branch.



  parent reply	other threads:[~2020-10-14 18:07 UTC|newest]

Thread overview: 209+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-12 20:58 Rethinking the design of xwidgets Akira Kyle
2020-10-12 22:18 ` joakim
2020-10-13 16:07   ` Akira Kyle
2020-10-13 19:06     ` joakim
2020-10-14  0:33       ` Akira Kyle
2020-10-13 13:36 ` Stefan Monnier
2020-10-13 16:09   ` Akira Kyle
2020-10-13 14:16 ` Eli Zaretskii
2020-10-13 17:05   ` Akira Kyle
2020-10-13 17:24     ` Qiantan Hong
2020-10-13 18:29       ` Akira Kyle
2020-10-13 18:44         ` Qiantan Hong
2020-10-13 19:17           ` Eli Zaretskii
2020-10-13 20:52           ` Akira Kyle
2020-10-14 14:36             ` Eli Zaretskii
2020-10-14 17:01               ` Stefan Monnier
2020-10-15 19:55                 ` arthur miller
2020-10-13 18:45         ` Eli Zaretskii
2020-10-13 21:00           ` Akira Kyle
2020-10-14 14:44             ` Eli Zaretskii
2020-10-15  0:35               ` Akira Kyle
2020-10-15  2:07                 ` Stefan Monnier
2020-10-15  3:35                   ` arthur miller
2020-10-15 15:06                     ` Eli Zaretskii
2020-10-15 15:20                       ` Arthur Miller
2020-10-15 15:48                         ` Eli Zaretskii
2020-10-13 17:55     ` Eli Zaretskii
2020-10-13 18:42       ` Basil L. Contovounesios
2020-10-13 19:10         ` Eli Zaretskii
2020-10-13 20:37       ` Akira Kyle
2020-10-14 14:33         ` Eli Zaretskii
2020-10-14 15:04           ` Arthur Miller
2020-10-14 15:32             ` Eli Zaretskii
2020-10-15 13:20               ` Arthur Miller
2020-10-17  4:26                 ` Kai Ma
2020-10-17  4:42                   ` Qiantan Hong
2020-11-14  5:40                   ` Richard Stallman
2020-10-14 16:53             ` Stefan Monnier
2020-10-14 18:56               ` Aiko Kyle
2020-10-15 12:48                 ` Arthur Miller
2020-10-15 16:25                   ` Akira Kyle
2020-10-15 12:35               ` Arthur Miller
2020-10-16  4:02             ` Richard Stallman
2020-10-16 13:03               ` Arthur Miller
2020-10-16 18:38                 ` Dmitry Gutov
2020-10-17  4:19                   ` Richard Stallman
2020-10-17  4:21                 ` Richard Stallman
2020-10-17  6:30                   ` Arthur Miller
2020-10-17 13:35                     ` Stefan Monnier
2020-10-17 19:15                       ` Arthur Miller
2020-10-19  3:44                         ` Richard Stallman
2020-10-18  4:17                     ` Richard Stallman
2020-10-18  4:17                     ` Richard Stallman
2020-10-18  9:31                       ` Dmitry Gutov
2020-10-19  3:44                         ` Richard Stallman
2020-10-19 12:37                           ` Dmitry Gutov
2020-10-19 13:43                             ` Arthur Miller
2020-10-20  5:13                               ` Richard Stallman
2020-10-20  5:47                                 ` Arthur Miller
2020-10-20 12:58                                   ` Stefan Monnier
2020-10-20 13:40                                     ` Arthur Miller
2020-10-21  4:42                                       ` Richard Stallman
2020-10-21  4:46                                   ` Richard Stallman
2020-10-20  5:14                             ` Richard Stallman
2020-10-20  5:56                               ` Arthur Miller
2020-10-20 10:45                                 ` Dmitry Gutov
2020-10-20 13:49                                   ` Arthur Miller
2020-10-21  4:46                                 ` Richard Stallman
2020-10-19 13:34                           ` Arthur Miller
2020-10-19 14:04                           ` Stefan Monnier
2020-10-20  5:13                             ` Richard Stallman
2020-10-18 14:41                       ` Arthur Miller
2020-10-19  3:48                         ` Richard Stallman
2020-10-19 13:48                           ` Arthur Miller
2020-10-16 14:54               ` Dmitry Gutov
2020-10-14 18:07           ` Akira Kyle [this message]
2020-10-14 18:32             ` Eli Zaretskii
2020-10-14 19:10               ` Akira Kyle
2020-10-13 18:36     ` Tomas Hlavaty
2020-10-13 18:38       ` Tomas Hlavaty
2020-10-13 21:20       ` Aiko Kyle
2020-10-14  0:12         ` Corwin Brust
2020-10-14 19:16           ` Akira Kyle
2020-10-14  7:32         ` Tomas Hlavaty
2020-10-14 15:02           ` Eli Zaretskii
2020-10-14 16:35             ` Tomas Hlavaty
2020-10-14 19:22               ` Akira Kyle
2020-10-14 21:29                 ` Tomas Hlavaty
2020-10-16  4:02                 ` Richard Stallman
2020-10-16 13:09                   ` Arthur Miller
2020-10-14 19:24     ` Mingde (Matthew) Zeng
2020-10-14 21:46       ` Akira Kyle
2020-10-15  5:17         ` Mingde (Matthew) Zeng
2020-10-14  4:38 ` Richard Stallman
2020-10-14  6:36   ` Akira Kyle
2020-11-22  3:35 ` Introducing emacs-webkit and more thoughts on Emacs rendering (was Rethinking the design of xwidgets) Akira Kyle
2020-11-22 12:01   ` Jean Louis
2020-11-22 12:04   ` Jean Louis
2020-11-22 12:18     ` tomas
2020-11-22 12:57       ` Jean Louis
2020-11-22 16:24         ` tomas
2020-11-22 17:18           ` Jean Louis
2020-11-22 17:48             ` tomas
2020-11-22 18:40             ` Akira Kyle
2020-11-22 19:58               ` Jean Louis
2020-11-22 20:29                 ` Akira Kyle
2020-11-22 20:38                   ` Jean Louis
2020-11-22 15:27     ` Arthur Miller
2020-11-22 12:50   ` Jean Louis
2020-11-22 18:33     ` Akira Kyle
2020-11-22 18:04   ` Eli Zaretskii
2020-11-22 18:46     ` Akira Kyle
2020-11-22 21:20       ` Vasilij Schneidermann
2020-11-22 22:04         ` Akira Kyle
2020-11-22 18:29   ` T.V Raman
2020-11-22 18:53     ` Akira Kyle
2020-11-22 19:35       ` T.V Raman
2020-11-22 20:26         ` Akira Kyle
2020-11-23  0:46           ` T.V Raman
2020-11-23  3:44             ` Akira Kyle
2020-11-23  3:01       ` T.V Raman
2020-11-23  3:47         ` Akira Kyle
2020-11-23 16:29           ` Jose A. Ortega Ruiz
2020-11-23  9:39   ` Lars Ingebrigtsen
2020-11-23 13:26     ` joakim
2020-11-24  6:21       ` Lars Ingebrigtsen
2020-11-23 14:59     ` Arthur Miller
2020-11-23 23:47       ` Alan Third
2020-11-24  3:58         ` Akira Kyle
2020-11-24  8:06         ` Arthur Miller
2020-11-24  5:51       ` Richard Stallman
2020-11-24  6:24         ` Lars Ingebrigtsen
2020-11-26  4:49           ` Richard Stallman
2020-11-26  5:25             ` Arthur Miller
2020-11-26  8:27               ` tomas
2020-11-26 14:55                 ` Arthur Miller
2020-11-26 19:11                 ` Tomas Hlavaty
2020-11-26 19:34                   ` arthur miller
2020-11-27  8:04                     ` Tomas Hlavaty
2020-11-27  8:44                       ` Arthur Miller
2020-11-27 13:35                     ` Richard Stallman
2020-11-27 19:22                       ` Arthur Miller
2020-11-27 20:01                         ` Eli Zaretskii
2020-11-27 21:22                           ` Arthur Miller
2020-11-27 20:07                         ` Stefan Monnier
2020-11-27 21:09                           ` Arthur Miller
2020-11-27 21:35                             ` Stefan Monnier
2020-11-27 23:23                               ` Arthur Miller
2020-11-28  0:28                                 ` Stefan Monnier
2020-11-28  8:48                                   ` Arthur Miller
2020-11-27 21:22                           ` Akira Kyle
2020-11-28  7:31                             ` Eli Zaretskii
2020-11-28  5:55                         ` Richard Stallman
2020-11-28  8:50                           ` Arthur Miller
2020-11-29  5:24               ` Richard Stallman
2020-11-24  7:50         ` Arthur Miller
2020-11-24  8:47           ` tomas
2020-11-24  9:04             ` Arthur Miller
2020-11-25  5:38               ` Richard Stallman
2020-11-25  8:46                 ` tomas
2020-11-25 15:26                 ` Arthur Miller
2020-11-25 16:15                   ` Eric S Fraga
2020-11-24 15:43             ` T.V Raman
2020-11-25  5:38             ` Richard Stallman
2020-11-25  8:54               ` tomas
2020-11-24  6:23       ` Lars Ingebrigtsen
2020-11-24  3:33     ` Akira Kyle
2020-11-24  6:27       ` Lars Ingebrigtsen
2020-11-25  1:36         ` Akira Kyle
2020-11-25 15:11           ` Eli Zaretskii
2020-11-27 20:56             ` Akira Kyle
2020-11-28  8:38               ` Eli Zaretskii
2020-11-28  8:57                 ` Arthur Miller
2020-11-28  9:19                   ` Eli Zaretskii
2020-11-29  0:22                     ` Arthur Miller
2020-11-29  1:29                 ` Akira Kyle
2020-11-29  8:22                   ` martin rudalics
2020-11-29 19:01                   ` Eli Zaretskii
2020-11-30  3:54                     ` Akira Kyle
2020-11-30 15:39                       ` Eli Zaretskii
2020-11-30 17:03                         ` Akira Kyle
2020-11-30 18:11                           ` Eli Zaretskii
2020-11-30 18:30                             ` Akira Kyle
2020-12-01  7:44                           ` Tomas Hlavaty
2020-12-03  0:24                             ` Akira Kyle
2020-12-03  8:07                               ` Tomas Hlavaty
2020-12-03 20:34                                 ` Arthur Miller
2020-12-03 20:53                                 ` Stefan Monnier
2020-12-01  8:01                       ` Tomas Hlavaty
2020-12-01 15:36                         ` Arthur Miller
2020-12-01 16:48                           ` Tomas Hlavaty
2020-12-01 15:58                         ` Eli Zaretskii
2020-12-01 17:33                           ` Tomas Hlavaty
2020-12-01 19:41                             ` Eli Zaretskii
2020-12-02 20:37                               ` Tomas Hlavaty
2020-12-03 14:39                                 ` Eli Zaretskii
2020-12-03 21:02                                   ` Tomas Hlavaty
2020-12-04  7:48                                     ` Eli Zaretskii
2020-12-03  0:37                         ` Akira Kyle
2020-12-03  8:15                           ` Tomas Hlavaty
2020-12-03 15:13                             ` Eli Zaretskii
2020-12-03 21:15                               ` Tomas Hlavaty
2020-12-04  8:00                                 ` Eli Zaretskii
2020-11-30  9:05                     ` martin rudalics
2020-11-30 16:10                       ` Eli Zaretskii
2020-11-23 22:12   ` Alexander Adolf
2020-11-24  1:30     ` T.V Raman
2020-11-24  8:13       ` Arthur Miller
2020-11-24  3:51     ` Akira Kyle

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=86pn5kbs0l.fsf@akirakyle.com \
    --to=ak@akirakyle.com \
    --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).