From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: macOS metal rendering engine in mac port Date: Sat, 22 May 2021 19:44:58 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39771"; mail-complaints-to="usenet@ciao.gmane.io" Cc: YAMAMOTO Mitsuharu , emacs-devel@gnu.org To: Aaron Jensen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 22 20:47:27 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lkWek-000A3u-8p for ged-emacs-devel@m.gmane-mx.org; Sat, 22 May 2021 20:47:26 +0200 Original-Received: from localhost ([::1]:50134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkWei-00026d-Cw for ged-emacs-devel@m.gmane-mx.org; Sat, 22 May 2021 14:47:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lkWdP-0001K5-LT for emacs-devel@gnu.org; Sat, 22 May 2021 14:46:03 -0400 Original-Received: from [217.169.17.33] (port=56880 helo=breton.holly.idiocy.org) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lkWdN-0005Jq-Q4 for emacs-devel@gnu.org; Sat, 22 May 2021 14:46:03 -0400 Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id 82A7B202C18B5B; Sat, 22 May 2021 19:44:58 +0100 (BST) Mail-Followup-To: Alan Third , Aaron Jensen , emacs-devel@gnu.org, YAMAMOTO Mitsuharu Content-Disposition: inline In-Reply-To: X-Host-Lookup-Failed: Reverse DNS lookup failed for 217.169.17.33 (failed) Received-SPF: none client-ip=217.169.17.33; envelope-from=alan@breton.holly.idiocy.org; helo=breton.holly.idiocy.org X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:269621 Archived-At: On Fri, May 21, 2021 at 04:02:07PM -0700, Aaron Jensen wrote: > On Fri, May 21, 2021 at 10:39 AM Alan Third wrote: > > > > Yes, and I don't think you need to do anything special with > > optimisation levels. > > > > Load instruments.app, choose "time profiler", then at the top select > > emacs and hit the record button. Do whatever you do, then hit the stop > > button, and the window below should give some indication of where it > > is spending the most time. I was thinking that it would be in the copy > > from one surface to the other, but I profiled my own build and it > > appears to be negligible. OTOH, since your surfaces are much bigger > > that might be it. > > > > I've tried reducing the amount of times the NS port updates the > > screen, although I don't think I've really been very successful, but > > you may as well give it a go and see if it makes any difference. > > Please try the scratch/ns/surface-stuff branch. > > I got 378 characters on this branch, which is a little faster. > I should also note that on Emacs 27 NS I get 578 characters, which is > slightly faster than Emacs mac port. On my machine the scroll benchmark shows Emacs 27 being able to update the screen more than twice as fast as any version of the Mac port, yet this shows Emacs 27 isn't really any better. Perhaps they both reach the maximum input rate? Or the NS port's event handling is slow, which is quite possible as it's single threaded and I think the Mac port uses a separate thread for toolkit stuff. (Someone please correct me if I'm wrong.) IIRC you said that you still thought input in Emacs 27 feels sluggish? > I've attached a couple profiles of the surface stuff branch. It turns out I can't open these because my version of xcode is too old... Although I think it's the most recent I can use on this machine. > Of note is that display-line-number-mode seems to be a massive > culprit in slowing this down. Turning that off about gives me about > 50% more performance. Does it give a similar slowdown in the Mac port? > The rest of what takes time appears to be mem copies, which makes > sense that that would scale w/ screen size. If someone wanted to send me a 5k screen, debugging this would be a lot easier. ;) -- Alan Third