From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Rendering performace vs. line-spacing Date: Fri, 08 Jan 2021 14:22:50 +0200 Message-ID: <83a6tjk485.fsf@gnu.org> References: <5f7dd7c3-ec7d-ffd5-76af-1a5ee5177d07@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34343"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: geza.herman@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jan 08 13:24:04 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 1kxqoF-0008r6-VB for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Jan 2021 13:24:03 +0100 Original-Received: from localhost ([::1]:56370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxqoE-0007bZ-TG for ged-emacs-devel@m.gmane-mx.org; Fri, 08 Jan 2021 07:24:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxqn6-00078d-2h for emacs-devel@gnu.org; Fri, 08 Jan 2021 07:22:52 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60578) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxqn5-0000uy-S2; Fri, 08 Jan 2021 07:22:51 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1937 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kxqn1-0006yP-CV; Fri, 08 Jan 2021 07:22:51 -0500 In-Reply-To: <5f7dd7c3-ec7d-ffd5-76af-1a5ee5177d07@gmail.com> (message from Herman, =?utf-8?Q?G=C3=A9za?= on Fri, 8 Jan 2021 12:34:53 +0100) 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:262739 Archived-At: > From: Herman, Géza > Date: Fri, 8 Jan 2021 12:34:53 +0100 > > I noticed that emacs's performance can depend on the font. For example, > Consolas has a much worse performance (scrolling is sluggish) than > BitStream Mono. I profiled emacs, and the main difference is > "draw_glyphs". When emacs is slow (using consolas), this function takes > 50-60% of CPU time (measured by "perf record -g"). When emacs is fast > (using BitStream), this function takes only ~2-3%. > > I played with my font's ascent and descent settings to have more line on > the screen (as emacs doesn't support negative line-spacing). Originally, > "draw_glyphs" takes 2-3% with my font. But if I decrease the height of > the font by modifying ascent/descent, then the same thing happens: > draw_glyphs takes 50-60% CPU time. If I set line-spacing to 2, > draw_glyphs become normal, 2-3% CPU time. > > (I'm using a master build from yesterday) > > Any ideas why this happens? Maybe this happens because lines may overlap > and some caching mechanism gets disabled? When screen lines can overlap, we have code to handle that, and it indeed could slow down redisplay. However, you are saying that you _decrease_ ascent/descent, and I'm not sure I understand how could that cause overlaps? In any case, I suggest to profile the code with perf, and see which parts of the display code (below draw_glyphs) take those cycles with the problematic font(s). Then we will see which part is the culprit, and could take it from there.