Subject: Re: bug#32932: 27.0.50; render bugs on macOS Mojave

From: Alan Third <[email-masked]>
Date: Sat, 25 Jan 2020 12:44:01 +0000

On Tue, Nov 12, 2019 at 02:38:04PM +0000, Alan Third wrote:
> On Tue, 12 Nov 2019, 13:28 Robert Pluim, <[email-masked]> wrote:
> 
> > >>>>> On Mon, 11 Nov 2019 18:16:22 +0000, Alan Third <[email-masked]> said:
> > > The main bit of the code is around the method
> > > createDrawingBufferWithRect in nsterm.m. It’s a simple bitmap
> > > and it’s very slow to draw to the screen (drawRect:). I think
> > > that there are things that can be done with layers and CGLayers,
> > > but I never managed to work out how it’s supposed to work, or if
> > > it’s even plausible. I don’t know if AppKit can draw directly to
> > > CGLayers.
> >
> > Question #1: How do you know itʼs slow? Iʼve been using it since this
> > morning, and it seems ok.
> >
> 
> A couple of people tried it and found it slow. I run a fairly vanilla Emacs
> and it looked ok to me, but if I full maximised it on my retina mac it was
> visibly slower at things like scrolling than the current master branch.

Hi Robert, I’d forgotten it was you who originally complained about
the performance.

I’ve been messing about with the branch and have been using this
benchmark nabbed from one of Eli’s posts on emacs devel:

    (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))))))

Maximised on my external 1920x1200 monitor the difference in that
benchmark with xdisp.c between drawing to a bitmap and using the
standard master branch is essentially nothing. Unfortunately using it
maximised on my laptop’s retina screen results in a difference of
something like 15 seconds (40 ‐> 55 ish).

On the other hand that’s a worst case scenario and in interactive use
it’s perfectly fine.

So we have a trade off here of slower performance, which may or may
not be an issue, against drawing anomalies. I’m beginning to feel it’s
probably better to just get rid of the drawing issues and live with
the performance hit. I know that for me the performance difference is
not going to be noticeable at all.

Do you have any thoughts on the matter?

(As an aside, if people using old hardware with old versions of macOS
find it slow we can easily set it to only use the backing buffer on
macOS 10.14+ and everyone else can use the same process as GNUstep,
which is the old pre‐Mojave drawing direct to the screen thing.)
-- 
Alan Third