unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Redundant if clause in xdisp.c?
@ 2009-08-29 12:46 Eli Zaretskii
  2009-08-29 14:16 ` Chong Yidong
  2009-08-29 15:50 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2009-08-29 12:46 UTC (permalink / raw)
  To: emacs-devel

Unless I'm missing something, both branches of the if clause below
(from xdisp.c:redisplay_internal) are identical, except for the
comments:

  		  if (Z - CHARPOS (tlendpos) == ZV)
		    {
		      /* This line ends at end of (accessible part of)
			 buffer.  There is no newline to count.  */
		      delta = (Z
			       - CHARPOS (tlendpos)
			       - MATRIX_ROW_START_CHARPOS (row));
		      delta_bytes = (Z_BYTE
				     - BYTEPOS (tlendpos)
				     - MATRIX_ROW_START_BYTEPOS (row));
		    }
  		  else
		    {
		      /* This line ends in a newline.  Must take
			 account of the newline and the rest of the
			 text that follows.  */
		      delta = (Z
			       - CHARPOS (tlendpos)
			       - MATRIX_ROW_START_CHARPOS (row));
		      delta_bytes = (Z_BYTE
				     - BYTEPOS (tlendpos)
				     - MATRIX_ROW_START_BYTEPOS (row));
		    }

  		  increment_matrix_positions (w->current_matrix,
					      this_line_vpos + 1,
					      w->current_matrix->nrows,
					      delta, delta_bytes);

Okay to remove the condition and to collapse both branches into a
single code fragment?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redundant if clause in xdisp.c?
  2009-08-29 12:46 Redundant if clause in xdisp.c? Eli Zaretskii
@ 2009-08-29 14:16 ` Chong Yidong
  2009-08-29 15:50 ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Chong Yidong @ 2009-08-29 14:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Unless I'm missing something, both branches of the if clause below
> (from xdisp.c:redisplay_internal) are identical, except for the
> comments: ...
>
> Okay to remove the condition and to collapse both branches into a
> single code fragment?

Yes, please.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redundant if clause in xdisp.c?
  2009-08-29 12:46 Redundant if clause in xdisp.c? Eli Zaretskii
  2009-08-29 14:16 ` Chong Yidong
@ 2009-08-29 15:50 ` Stefan Monnier
  2009-08-29 17:40   ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2009-08-29 15:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

> Okay to remove the condition and to collapse both branches into a
> single code fragment?

Looks like a good idea, yes.  BTW, before playing with the redisplay,
please just throw away keyboard.c's handling of self-insert-command,
forward-char and backward-char, as well as the corresponding
"direct-rendering fast-path" code.

These optimizations seem to be pointless nowadays: even when running
Emacs-23 on my cell-phone (FreeRunner) displaying on my desktop, they
don't make any noticeable difference.

I refrained from installing this change for Emacs-23.2, out of fear
bigfoot might come and bite me, but I'll definitely install it for
Emacs-24.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redundant if clause in xdisp.c?
  2009-08-29 15:50 ` Stefan Monnier
@ 2009-08-29 17:40   ` Eli Zaretskii
  2009-08-29 21:21     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2009-08-29 17:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Sat, 29 Aug 2009 11:50:39 -0400
> 
> > Okay to remove the condition and to collapse both branches into a
> > single code fragment?
> 
> Looks like a good idea, yes.

Done.

> BTW, before playing with the redisplay, please just throw away
> keyboard.c's handling of self-insert-command, forward-char and
> backward-char, as well as the corresponding "direct-rendering
> fast-path" code.

These optimizations are disabled for bidi redisplay anyway, so they
don't bother me.

> These optimizations seem to be pointless nowadays: even when running
> Emacs-23 on my cell-phone (FreeRunner) displaying on my desktop, they
> don't make any noticeable difference.

How did you turn them off to measure their influence, and with what
kind of stuff in your buffer(s)?

> I refrained from installing this change for Emacs-23.2, out of fear
> bigfoot might come and bite me, but I'll definitely install it for
> Emacs-24.

OK, but for now I'd prefer not to do any changes in my bidi sandbox
that are not strictly related to bidirectional editing.  Once we have
a way to commit these changes to CVS, fine with me, if we are sure
these optimizations don't matter anymore.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redundant if clause in xdisp.c?
  2009-08-29 17:40   ` Eli Zaretskii
@ 2009-08-29 21:21     ` Stefan Monnier
  2009-08-30 18:06       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2009-08-29 21:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

>> BTW, before playing with the redisplay, please just throw away
>> keyboard.c's handling of self-insert-command, forward-char and
>> backward-char, as well as the corresponding "direct-rendering
>> fast-path" code.

> These optimizations are disabled for bidi redisplay anyway, so they
> don't bother me.

Good.

>> These optimizations seem to be pointless nowadays: even when running
>> Emacs-23 on my cell-phone (FreeRunner) displaying on my desktop, they
>> don't make any noticeable difference.

> How did you turn them off to measure their influence,

I removed the corresponding code.

> and with what kind of stuff in your buffer(s)?

I tried it in *scratch* and in a Python-mode buffer (visiting
/usr/bin/zhone), doing random movement and typing (especially using the
auto-repeat to see when the redisplay keeps up and when it doesn't).

>> I refrained from installing this change for Emacs-23.2, out of fear
>> bigfoot might come and bite me, but I'll definitely install it for
>> Emacs-24.

> OK, but for now I'd prefer not to do any changes in my bidi sandbox
> that are not strictly related to bidirectional editing.  Once we have
> a way to commit these changes to CVS, fine with me, if we are sure
> these optimizations don't matter anymore.

Sure, I just wanted to make sure you don't waste time in these parts of
the code.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Redundant if clause in xdisp.c?
  2009-08-29 21:21     ` Stefan Monnier
@ 2009-08-30 18:06       ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2009-08-30 18:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sat, 29 Aug 2009 17:21:42 -0400
> Cc: emacs-devel@gnu.org
> 
> >> These optimizations seem to be pointless nowadays: even when running
> >> Emacs-23 on my cell-phone (FreeRunner) displaying on my desktop, they
> >> don't make any noticeable difference.
> 
> > How did you turn them off to measure their influence,
> 
> I removed the corresponding code.

I think it's enough to set direction-reversed non-nil.

> > and with what kind of stuff in your buffer(s)?
> 
> I tried it in *scratch* and in a Python-mode buffer (visiting
> /usr/bin/zhone), doing random movement and typing (especially using the
> auto-repeat to see when the redisplay keeps up and when it doesn't).

GUI session or tty?  The price of disabling these optimizations might
be more visible on a tty via a relatively slow link.  I don't think we
should remove them before we try at least that.

> Sure, I just wanted to make sure you don't waste time in these parts of
> the code.

The first rule of optimization: don't do it.  The second rule of
optimization: don't do it yet.  I'm somewhere before the first and the
second one: I need to get the code work right before I make it faster
(if needed).




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-30 18:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-29 12:46 Redundant if clause in xdisp.c? Eli Zaretskii
2009-08-29 14:16 ` Chong Yidong
2009-08-29 15:50 ` Stefan Monnier
2009-08-29 17:40   ` Eli Zaretskii
2009-08-29 21:21     ` Stefan Monnier
2009-08-30 18:06       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).