From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Adrian Robert Newsgroups: gmane.emacs.bugs Subject: bug#2530: 23/NS: redraws according to mouse-face are slow Date: Tue, 5 May 2009 17:36:31 +0700 Message-ID: <1ACB40A8-4422-4B9A-A0F7-FE0B9C738299__29393.9983509064$1241520749$gmane$org@gmail.com> References: <4383E9F6-9B66-4DA4-AA3C-D602EB059B97@gmail.com> <139B721E-A1B4-4256-B202-D4472C0331FB@gmail.com> <87d4aowc1l.fsf@cyd.mit.edu> <2E6E5869-2F70-4AF5-A917-7EA863D6BD42@gmail.com> Reply-To: Adrian Robert , 2530@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v753.1) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1241520749 28845 80.91.229.12 (5 May 2009 10:52:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 May 2009 10:52:29 +0000 (UTC) Cc: 2530@emacsbugs.donarmstrong.com, Chong Yidong , Ian Eure , Emacs-Devel devel To: David Reitter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 05 12:52:19 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M1IG2-00005U-Fh for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 May 2009 12:52:18 +0200 Original-Received: from localhost ([127.0.0.1]:42777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M1IG1-0006dv-MH for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 May 2009 06:52:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M1IFq-0006bp-Ei for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 06:52:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M1IFh-0006XO-PI for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 06:52:01 -0400 Original-Received: from [199.232.76.173] (port=58087 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M1IFh-0006X4-Bp for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 06:51:57 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:44855) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M1IFg-00036Q-L8 for bug-gnu-emacs@gnu.org; Tue, 05 May 2009 06:51:57 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n45AprSb010724; Tue, 5 May 2009 03:51:54 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n45Aj4tM008166; Tue, 5 May 2009 03:45:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Adrian Robert Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs , owner@emacsbugs.donarmstrong.com Resent-Date: Tue, 05 May 2009 10:45:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 2530 X-Emacs-PR-Package: emacs,ns X-Emacs-PR-Keywords: Original-Received: via spool by 2530-submit@emacsbugs.donarmstrong.com id=B2530.12415198076660 (code B ref 2530); Tue, 05 May 2009 10:45:04 +0000 Original-Received: (at 2530) by emacsbugs.donarmstrong.com; 5 May 2009 10:36:47 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.183]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n45Aahar006649 for <2530@emacsbugs.donarmstrong.com>; Tue, 5 May 2009 03:36:44 -0700 Original-Received: by wa-out-1112.google.com with SMTP id m28so1895241wag.1 for <2530@emacsbugs.donarmstrong.com>; Tue, 05 May 2009 03:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:in-reply-to:references :mime-version:content-type:message-id:cc:content-transfer-encoding :from:subject:date:to:x-mailer; bh=biewUTrKoLvaK1qsodL2M1T8sRg2z7sok2b88jkLMlk=; b=X0mUrPVkExIOAslH/vxgtirVaNhrU5pp7OJK9dCsJEodTApMKiUwS6V4OlTRK85sD2 01h3HJtqicNXD67jgeLV1jDgaKx1yLjWoJu6rHQEFol0Vv368z6zJE5xmp2+v0qNGbQP EC4mqqiQAz2heupkjq2oqkBuGVQcNmfDVbors= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=in-reply-to:references:mime-version:content-type:message-id:cc :content-transfer-encoding:from:subject:date:to:x-mailer; b=OzxtnUV7He3fGywHcjamZ9NFrZVO8q9S8VGcR6p2URXbb0EWaXm0gllX7AdVsGsc82 nUq1vuGj5DRWRl5GU6MIVuY6RDFa9TYqJSp9S926WD2DujA1WDHSWGyQOnmhLY3q2VWd 5j/OqzxDORnillpiptujwx/uu+ux7BEJvw4H4= Original-Received: by 10.114.210.3 with SMTP id i3mr5140197wag.186.1241519803030; Tue, 05 May 2009 03:36:43 -0700 (PDT) Original-Received: from ?10.174.91.31? ([203.146.63.184]) by mx.google.com with ESMTPS id v25sm11317088wah.67.2009.05.05.03.36.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 05 May 2009 03:36:42 -0700 (PDT) In-Reply-To: <2E6E5869-2F70-4AF5-A917-7EA863D6BD42@gmail.com> X-Mailer: Apple Mail (2.753.1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 05 May 2009 06:52:01 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27711 Archived-At: On May 5, 2009, at 10:37 AM, David Reitter wrote: > On May 4, 2009, at 9:53 PM, Chong Yidong wrote: > >> I see. It seems ns_draw_glyph_string is a lot more expensive that >> x_draw_glyph_string. The show_mouse_face function assumes that the >> *_draw_glyph_string operation is relatively cheap, which is why it's >> called inside a loop. >> >> My guess is that the problem lies in the calls to ns_focus and >> ns_unfocus in ns_draw_glyph_string. > > Right - but we still need them, at least for clipping. > That said, because of the clipping, calls to ns_focus may be more > expensive than desirable. We have multiple calls to > ns_draw_glyph_string, often more than one for each row, but we only > need one clipping for the whole frame. So, ideally we'd call > ns_focus outside the loops that call ns_draw_glyph_string, but the > architecture won't allow that. > >>> If we wrap the code in show_mouse_face in NS[Dis|En]ableScreen, the >>> problem goes away for me (and it's not just delayed). Same for the >>> header-line/overlay issues I reported in #2530. >> >> If possible, we should minimize the amount of platform-dependent code >> inside xdisp.c. Could you experiment with putting these calls >> somewhere >> in nsterm.m, say surrounding the calls to note_mouse_highlight? >> >> Also, could it be ns_update_begin and ns_update_end that you want to >> call, instead of NSDisableScreen and NSEnableScreen? > > Yes, sure, this variant works well, and it takes care of the ugly > flicker as well. > (However, when moving the mouse over a piece of text with (common) > mouse-face property, we shouldn't need to redraw in the first > place, and that should be addressed at some point, perhaps after > 23.1.) That ns_update_begin() acheives the same effect suggests that perhaps the core mouse face code should do this (through the RIF). ns_draw_glyph_string() is not slow for any other operations, despite the fact that it is called with the same granularity (same-face-glyph- run) everywhere, likely because the update_begin()/end() batching is used. (And yes, thanks for tracking this David!) -Adrian