[Top][All Lists]

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

Re: Region cache for bidi paragraphs?

From: Eli Zaretskii
Subject: Re: Region cache for bidi paragraphs?
Date: Mon, 05 Aug 2013 18:18:09 +0300

> Date: Mon, 05 Aug 2013 09:26:37 +0400
> From: Dmitry Antipov <address@hidden>
> CC: address@hidden
> Input 0: xdisp.c
> Input 1: ASCII text 30K lines, 1000chr/line, no paragraph separators
> Input 2: ASCII text 30K lines, 1000chr/line, paragraph separator after each 
> line
> Time is in seconds as reported, smaller is better.
> Input  0        1        0 cached 1 cached
> -------+--------+--------+--------+-------
> 0      30.2     12.7     30.4     12.7
> 1      11.1     34.5     6.4      15.3
> 2      6.0      13.1     5.2      13.1
> ------------------------------------------
> I.e. longer lines and smaller amount of paragraph separators =>
> more benefits from using region cache.

Thanks for the data.

The gains sound marginal to me, especially given that the use case
where the gains are tangible (Input 1, very long line and no paragraph
separators anywhere in sight) doesn't look like a frequent use case.
Even in that case you get a speedup of a few milliseconds per
redisplay cycle.

I'm not sure this is worth the extra complexity, but if Stefan thinks
otherwise, I won't object.

There's one problem with your suggestion that perhaps needs to be
fixed before this is installed: you invalidate the cache on each
modification of the buffer, so scrolling through a buffer in a mode
that has font-lock set up will constantly invalidate the cache, since
adding text properties constitutes a "modification" of the buffer
text.  When I scroll through xdisp.c, I see the breakpoint set where
you invalidate the cache in insdel.c being constantly hit whenever
Emacs scrolls some new text into view.

Since most modes have font lock nowadays, I think leaving this
unhandled will all but eliminate the gains in most use cases.

reply via email to

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