emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs NS 'scratch/ns/draw-to-bitmap' branch performance


From: Alan Third
Subject: Re: Emacs NS 'scratch/ns/draw-to-bitmap' branch performance
Date: Wed, 5 Feb 2020 23:10:06 +0000

On Wed, Feb 05, 2020 at 11:00:05AM -0500, Daniel Pittman wrote:
> G'day Alan, et al.
> 
> After building Emacs with the ns/draw-to-bitmap branch merged, on macOS
> 10.15.2, I'm seeing some performance issues.  I'd like, Alan, to know how
> you would prefer me to proceed in a way that best helps you (and anyone
> else here) resolve them.
> 
> This is on a MacBook Pro (15-inch, 2019), Intel UHD Graphics 630 1536 MB +
> Radeon Pro 555X machine, driving the 2880 x 1800 internal LCD at the
> default 1680 x 1050 apparent resolution.  `frame-edges` are at 78, 45 and
> 1677, 1049, as far as Emacs is concerned.
> 
> The trivial reproduction, for me, is to hold any key (eg: "n") to get
> auto-repeat inserting it.  On this machine I see approximately 50
> characters every 10 seconds, or ~ 5 "frames" per second.  This is, of
> course, substantially lower than anywhere else in the OS, and also far
> below what I'd experience prior to that merge.
> 
> This is a pretty clear "graphics update" cost:
> (list (progn (goto-char 0) (benchmark-run 40 (next-line))) (progn
> (goto-char 0) (benchmark-run 40 (next-line) (redisplay))))
> => ((0.006762000000000001 0 0.0) (9.116147 0 0.0))
> 
> I can dig into this myself, and see if I can't figure out what is slowing
> everything down, but I figured I'd ask first.

To start with you should probably try the attached patch. I find it
much faster, but others still report it as unacceptably slow.

> PS: I didn't check yet, but one of my first points of call is going to be
> the "canDrawConcurrently" flag on the NSView, since the bitmap rep means it
> doesn't need to block anything while redrawing, yes?
> 
> https://developer.apple.com/documentation/appkit/nsview/1483425-candrawconcurrently?language=objc

That makes sense, but I’ve added that to the patch, but it doesn’t
seem to make much of a difference here.

You can try commenting it out at nsterm.m:7431, see if you can see any
difference. Perhaps we need to do something different to really let it
do its thing?

Honestly, though, I’d be happy for you to have a look as we’re rather
struggling. Using the offscreen bitmap means Emacs doesn’t have any
odd graphical glitches. The other method, described here

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32932#412

does have serious glitches but has *much* better performance.
-- 
Alan Third

Attachment: v3-0001-Use-CGLayer-instead-of-NSBitmapImageRep-bug-32932.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]