Problem: Placing many signs, for example with sign_placelist(), is
slower than necessary because buf_addsign() rescans the
buffer's sign list from its head for every sign to find the
insertion point, which is quadratic in the number of signs.
Solution: Remember the last inserted sign and resume the search from it
when the next sign is on a later line (Julien Voisin).
buf_addsign() inserts signs in line-number order, so when signs are placed on distinct, ascending lines (the common case for sign_placelist() and for plugins that place many signs) resuming each search from the previously inserted sign instead of the head makes the total work linear rather than quadratic. Signs placed on the same line still fall back to a scan from the head.
Placing 16000 signs with explicit ids in ascending order drops from about a quarter of a second to a few milliseconds.
https://github.com/vim/vim/pull/21237
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()