emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Long lines and bidi


From: Eli Zaretskii
Subject: Re: Long lines and bidi
Date: Sat, 09 Feb 2013 10:46:11 +0200

> Date: Fri, 08 Feb 2013 19:34:20 -0800
> From: Paul Eggert <address@hidden>
> CC: Dmitry Antipov <address@hidden>, address@hidden
> 
> On 02/08/2013 08:52 AM, Eli Zaretskii wrote:
> >> > So, ~90% of time spent in scan_buffer is:
> >> > 
> >> > 799                while (*cursor != target && --cursor >= ceiling_addr)
> >> > 800                  ;
> 
> > Which cannot be optimized.
> 
> It can be sped up somewhat, by using memrchr.
> 
> This won't solve these performance issues, but it helps:
> on my platform (x86-64 Ubuntu 12.10) I ran Dmitry's scroll-both benchmark
> <http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00147.html>
> on a real file (the trunk's src/xdisp.c), and it was 25% faster overall
> (1.19 seconds versus 1.49 seconds) when I used memrchr there
> and memchr for forward searches.

25% faster is still terribly slow for redisplay.  xdisp.c doesn't have
a problem in the first place (1.49 sec divided by 100 is 15 msec, not
something users will notice, let alone the difference between 15 and
11 msec).  And for files with long lines, these 25% will not solve
anything, since 6 sec _per_scroll_, give or take 25%, is intolerably
slow.

I don't think we should make this optimization, because it optimizes
in the wrong place.  The problem is not with scan_buffer, the problem
is that it (actually, its callers) get called way too much.

This is a classic case where solving a slow operation needs a radical
change in the algorithms, not loophole optimizations.

> Most of the attached patch is boilerplate taken unmodified from gnulib,
> to support memrchr on non-GNU platforms.  The key part of the change is
> at the end, to src/search.c.

I don't understand why you removed the TARGET argument of
scan_buffer.  The fact that all its callers use it for looking for a
newline doesn't mean it cannot be used otherwise.  At the very least,
the name of the function should be changed to reflect the change.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]