Subject: Re: bug#26051: 25.1; overlays may make emacs very slow

From: Eli Zaretskii <[email-masked]>
Date: Sun, 12 Mar 2017 17:47:47 +0200

> From: [email-masked]
> Cc: [email-masked]
> Date: Sun, 12 Mar 2017 10:44:21 +0900
> 
> >>   "@%d\n"
> >>   "?%d\n"
> >>   "\u00E1%d\n" ;; LATIN SMALL LETTER A WITH ACUTE
> >>   "\u3042%d\n" ;; HIRAGANA LETTER A
> >>   "\u4E00%d\n" ;; CJK IDEOGRAPH-4E00
> >>   "\uFF41%d\n" ;; FULLWIDTH LATIN SMALL LETTER A
> >
> > What I see here, with all of the above except the first two, is that
> > what takes a long time is for the code to run; once I see "Done" in
> > the echo area, redisplay takes less than a second.
> 
> Why is it take long time to use multibyte characters?
> 2 seconds and 2 minutes are very different.

My guess is because we need to compute the byte position of the
markers that store the overlay's beginning and end.  But that's just a
guess.

Btw, your original recipe will produce a much faster redisplay if you
set bidi-paragraph-direction of the buffer to left-to-right, instead
of leaving it at its default nil value.  Sorry I didn't mention this
earlier.