[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26051: 25.1; overlays may make emacs very slow
From: |
ynyaaa |
Subject: |
bug#26051: 25.1; overlays may make emacs very slow |
Date: |
Mon, 13 Mar 2017 20:18:55 +0900 |
Eli Zaretskii <eliz@gnu.org> writes:
> 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.
I tested with markers.
Markers make emacs slow too(a little bit faster than overlays).
M-x occur may make a buffer have thousands of markers,
and make point motion commands slow.
(benchmark
1
'(with-temp-buffer
(let ((n 65536))
(save-excursion (dotimes (i n) (insert (format "\u00E1%d\n" i))))
(dotimes (i n) (make-overlay (point) (point)) (forward-line)))))
=>"Elapsed time: 129.815000s (0.277000s in 17 GCs)"
(benchmark
1
'(with-temp-buffer
(let ((n 65536) tmp)
(save-excursion (dotimes (i n) (insert (format "\u00E1%d\n" i))))
(dotimes (i n)
;; protect against garbage collection
(setq tmp (cons (list (point-marker) (point-marker)) tmp))
(forward-line)))))
=>"Elapsed time: 90.038000s (0.272000s in 16 GCs)"
> 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.
It is a good solution for me, thanks.