Subject: bug#77924: 31.0.50; [Feature branch] Change marker implementation

From: Eli Zaretskii <[email-masked]>
Date: Fri, 25 Apr 2025 18:55:06 +0300

> From: Gerd Möllmann <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],
>   [email-masked]
> Date: Fri, 25 Apr 2025 16:08:14 +0200
> 
> > * master Results
> >
> >   | test          | non-gc (s) | gc (s) | gcs | total (s) | err |
> >   |---------------+------------+--------+-----+-----------+-----|
> >   | font-lock     |       0.52 |   0.32 |  24 |      0.84 |  0% |
> >   | smie          |       1.19 |   0.50 |  36 |      1.69 |  0% |
> >   | smie-nonascii |       2.13 |   0.53 |  39 |      2.66 |  0% |
> >   |---------------+------------+--------+-----+-----------+-----|
> >   | total         |       3.83 |   1.35 |  99 |      5.19 |  0% |
> >
> > * text-index Results
> >
> >   | test          | non-gc (s) | gc (s) | gcs | total (s) | err |
> >   |---------------+------------+--------+-----+-----------+-----|
> >   | font-lock     |       0.51 |   0.31 |  23 |      0.82 |  0% |
> >   | smie          |       1.18 |   0.45 |  33 |      1.63 |  0% |
> >   | smie-nonascii |       5.49 |   0.48 |  35 |      5.98 |  0% |
> >   |---------------+------------+--------+-----+-----------+-----|
> >   | total         |       7.19 |   1.24 |  92 |      8.43 |  0% |
> >
> > That shows also the difference in smie-nonascii, i.e. in a C file
> > containing multi-byte characters (one should suffice to make
> > Z != Z_BYTE, and the index is used).
> 
> I've been reading smie a bit, to get an impression what the smie
> slowdown might mean in daily use. As far as I can see elb-smie is basically
> 5 times
> 
>   (indent-region (point-min) (point-max)
>   -> indent-region-line-by-line for all lines
>   -> indent-region-according-to-mode
>   ...
> 
> xmenu.c has ca. 2500 lines, so 12500 line-by-line indentations.
> in 5.49s -> ca. 0.44ms per line. Or, taking 50ms as something a user might
> perceive, 113 lines.
> 
> TBH, I feel somewhat under-motivated to try and optimize that.

Do you understand why the branch is slower here?  If so, can you
describe the reasons, so we could then think if thye same reasons
could slow down other cases?