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

From: Gerd Möllmann <[email-masked]>
Date: Tue, 22 Apr 2025 18:15:29 +0200

Stefan Monnier <[email-masked]> writes:

> As discussed in the other thread, this performs fairly few
> charpos->bytepos conversions, actually.  Instead it spends most of its
> time inside the `diffseq.h` code.  You could try something like:
>
>     (require 'subr-x)
>     
>     (defun elb-replace-region-contents-entry ()
>       (with-temp-buffer
>         (let ((step (apply #'concat (make-list 2000 "🙂été👶🏿 "))))
>           (dotimes (_ (/ 500000 (length step)))
>             (insert step))
>     
>           (dotimes (_ 100000)
>             (let* ((a (+ (point-min) (random (buffer-size))))
>                    (b (min (+ a (length step) (random 512) -256) (point-max))))
>               (replace-region-contents a b (lambda () step)))))))
>
> which should spend more time in Emacs's code (especially in
> `buffer_chars_equal`) than in `diffseq.h`

Tried to run that on my mini, but it didn't finish in ca. 2h. So I tried
to call that function on my MB, and had to kill my Emacs :-).

Anyway, the other benchmarks showed an improvement over master, so I'm
content.