[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optimizing performance of buffer markers
From: |
Robert Pluim |
Subject: |
Re: Optimizing performance of buffer markers |
Date: |
Sun, 26 Jun 2022 12:32:51 +0200 |
>>>>> On Sat, 25 Jun 2022 12:47:38 +0800, Ihor Radchenko <yantar92@gmail.com>
>>>>> said:
Ihor> AFAIU, buf_bytepos_to_charpos tries to search for the closest marker
Ihor> near the requested bytepos. It currently does it using the following
Ihor> heuristics (roughly):
Ihor> (let ((threshold 50))
Ihor> (dolist (marker markers)
Ihor> (if (or (< (abs (- marker bytepos)) threshold)
Ihor> (< (abs (- nearest_previous_marker bytepos)) threshold))
Ihor> (throw 'found marker)
Ihor> (cl-incf threshold 50))))
Ihor> If we store markers in a hash table, there will be no benefit - Hash
Ihor> table will only allow to find marker at exact position, not nearby.
We could use (charpos / 50) as the key to the hash table, and then
store a list of markers as the value(s). Of course you'd have to
update the hash table every time a marker is added, deleted, or
changes charpos, so I donʼt know if it would be a win.
Robert
--
- Re: Exposing buffer text modifications to Lisp, (continued)
- Re: Exposing buffer text modifications to Lisp, Ihor Radchenko, 2022/06/21
- Re: Exposing buffer text modifications to Lisp, Eli Zaretskii, 2022/06/21
- Optimizing performance of buffer markers (was: Exposing buffer text modifications to Lisp), Ihor Radchenko, 2022/06/25
- Re: Optimizing performance of buffer markers, Stefan Monnier, 2022/06/25
- Re: Optimizing performance of buffer markers, Eli Zaretskii, 2022/06/25
- Re: Optimizing performance of buffer markers, Stefan Monnier, 2022/06/25
- Re: Optimizing performance of buffer markers, Eli Zaretskii, 2022/06/25
- Re: Optimizing performance of buffer markers, Stefan Monnier, 2022/06/25
- Re: Optimizing performance of buffer markers, Ihor Radchenko, 2022/06/25
- Re: Optimizing performance of buffer markers, Stefan Monnier, 2022/06/25
- Re: Optimizing performance of buffer markers,
Robert Pluim <=
- Re: Exposing buffer text modifications to Lisp, Basil L. Contovounesios, 2022/06/22
- Re: Exposing buffer text modifications to Lisp, Eli Zaretskii, 2022/06/22
- Re: Exposing buffer text modifications to Lisp, Ihor Radchenko, 2022/06/25
- Re: Exposing buffer text modifications to Lisp, Eli Zaretskii, 2022/06/25
- Re: Exposing buffer text modifications to Lisp, Ihor Radchenko, 2022/06/29
- Re: Exposing buffer text modifications to Lisp, Alan Mackenzie, 2022/06/20
- Re: Exposing buffer text modifications to Lisp, Ihor Radchenko, 2022/06/20
Re: Tree-sitter integration on feature/tree-sitter, Eli Zaretskii, 2022/06/17