From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 5c9304e: Disable some display optimizations when frames need redisplay Date: Sat, 03 Oct 2015 00:24:00 +0300 Message-ID: <83vbap3qxb.fsf@gnu.org> References: <20150930193450.11644.62040@vcs.savannah.gnu.org> <831tdd75i3.fsf@gnu.org> <83eghd5ff2.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1443821342 30572 80.91.229.3 (2 Oct 2015 21:29:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 Oct 2015 21:29:02 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 02 23:28:52 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zi7sm-0005r2-AR for ged-emacs-devel@m.gmane.org; Fri, 02 Oct 2015 23:28:48 +0200 Original-Received: from localhost ([::1]:35268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi7sl-0000Xj-Eg for ged-emacs-devel@m.gmane.org; Fri, 02 Oct 2015 17:28:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi7oK-0006iD-Pd for emacs-devel@gnu.org; Fri, 02 Oct 2015 17:24:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi7oG-0006Vl-R1 for emacs-devel@gnu.org; Fri, 02 Oct 2015 17:24:12 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:51460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi7oG-0006Sz-JQ for emacs-devel@gnu.org; Fri, 02 Oct 2015 17:24:08 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NVM00E002Z72D00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 03 Oct 2015 00:24:06 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NVM00EI43G62V10@a-mtaout20.012.net.il>; Sat, 03 Oct 2015 00:24:06 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:190749 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Fri, 02 Oct 2015 16:55:00 -0400 > > >> >> So, what am I missing? > >> > The setting of windows_or_buffers_changed in fset_redisplay can now be > >> > removed. > >> Why would we want to do that? > > > Because a global variable cannot possibly convey the information that > > only frames F1 and F2 need to be redisplayed. Only frame-specific > > variables can do that. > > I know. But the way windows_or_buffers_changed works, currently it has > 3 possible values: > - 0: only the selected-window needs to be redisplayed. > - 2: all frames/windows/buffers which have the `redisplay' bit set need > to be redisplayed > - >2: all frames&windows need to be redisplayed. > > So, the value 2 (aka REDISPLAY_SOME) already gives you the information > that "only frames F1 and F2 need to be redisplayed". But you need to examine the frame's 'redisplay' flag anyway. So that special value of windows_or_buffers_changed just adds management (you need to reset it, and it can acquire higher values depending on what redisplay_internal discovers), without adding any value. The loop over all frames checking whether any have the 'redisplay' flag set is fast, so there's no need for a global flag to convey that. > 100% agreement, and that's why I introduced those `redisplay' bits and > the corresponding REDISPLAY_SOME value for windows_or_buffers_changed. > > And AFAIK it already has the effect that when we call fset_redisplay only > those frames get redisplayed. Maybe so, but the effect of this on frames is completely undocumented, and the name REDISPLAY_SOME has no mnemonic value that helps realize its meaning. Also, the fact that fset_redisplay, a setter function, also sets windows_or_buffers_changed (and then does some more) is IMO not a good idea, as it gets in the way of understanding the logic without reading all the functions that are called, just by looking at their names. Anyway, I wish all this was written somewhere, rather than divulged in a discussion of some commit. The fact that you never documented these parts in the code, and I never until now knew them, is regrettable, to say the least. > Also rather than "don't set windows_or_buffers_changed in > fset_redisplay", it seems like it would be safer to try and eliminate > (one by one) the places where we check the value of > windows_or_buffers_changed instead of checking f->redisplay or something > like that. You cannot eliminate windows_or_buffers_changed without replacing them with something. They are there for a reason. It could be that the effect of having that variable non-zero is too radical, and causes too thorough redisplay, but then the solution is surely not elimination.