* bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance
@ 2024-07-05 11:11 Eval Exec
2024-07-06 6:23 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Eval Exec @ 2024-07-05 11:11 UTC (permalink / raw)
To: 71958
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: 0001-Improve-tab-line-tabs-fixed-window-buffers-sorting-p.patch --]
[-- Type: text/x-patch, Size: 1772 bytes --]
From fa047a52c0d40aace236bd56f1d8ca70935f438a Mon Sep 17 00:00:00 2001
From: Eval EXEC <execvy@gmail.com>
Date: Fri, 5 Jul 2024 18:53:36 +0800
Subject: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting
performance
* lsp/tab-line.el (tab-line-tabs-fixed-window-buffers): Enhanced
`tab-line-tabs-fixed-window-buffers` performance by optimizing buffer
sorting mechanism. Replaced inefficient `seq-position` calls with a hash
table to cache buffer positions, significantly improving speed when
handling large buffer lists.
---
lisp/tab-line.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 1d14fda9825..e4908c61542 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -555,10 +555,14 @@ This means that switching to a buffer previously shown in the same
window will keep the same order of tabs that was before switching.
And newly displayed buffers are added to the end of the tab line."
(let* ((old-buffers (window-parameter nil 'tab-line-buffers))
+ (buffer-positions (let ((index-table (make-hash-table :test 'eq)))
+ (seq-do-indexed
+ (lambda (buf idx) (puthash buf idx index-table))
+ old-buffers)
+ index-table))
(new-buffers (sort (tab-line-tabs-window-buffers)
:key (lambda (buffer)
- (or (seq-position old-buffers buffer)
- most-positive-fixnum)))))
+ (gethash buffer buffer-positions most-positive-fixnum)))))
(set-window-parameter nil 'tab-line-buffers new-buffers)
new-buffers))
--
2.44.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance
2024-07-05 11:11 bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance Eval Exec
@ 2024-07-06 6:23 ` Eli Zaretskii
2024-07-07 16:51 ` Juri Linkov
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2024-07-06 6:23 UTC (permalink / raw)
To: Eval Exec; +Cc: 71958
> From: Eval Exec <execvy@gmail.com>
> Date: Fri, 5 Jul 2024 19:11:54 +0800
Thanks. I'll leave it to Juri to review the code and comment, but
just minor nits on your commit log message:
> * lsp/tab-line.el (tab-line-tabs-fixed-window-buffers): Enhanced
> `tab-line-tabs-fixed-window-buffers` performance by optimizing buffer
> sorting mechanism. Replaced inefficient `seq-position` calls with a hash
> table to cache buffer positions, significantly improving speed when
> handling large buffer lists.
Our style is to say "Enhance" and "Replace", not "Enhanced" and
"Replaced". Also, we use the US English convention of leaving two
spaces between sentences. Finally, please quote symbols 'like this',
not `like this`.
In addition, I'd encourage you to start your legal paperwork of
assigning the copyright to the FSF at this time, so we could accept
your contributions without any restrictions. If you are willing to
start the paperwork now, I will send you the form to fill and the
instructions to go with it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance
2024-07-06 6:23 ` Eli Zaretskii
@ 2024-07-07 16:51 ` Juri Linkov
2024-07-07 17:33 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Juri Linkov @ 2024-07-07 16:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 71958, Eval Exec
>> From: Eval Exec <execvy@gmail.com>
>> Date: Fri, 5 Jul 2024 19:11:54 +0800
>
> I'll leave it to Juri to review the code and comment, but
> just minor nits on your commit log message:
I confirm this is the right fix.
Thanks to Eval Exec.
> In addition, I'd encourage you to start your legal paperwork of
> assigning the copyright to the FSF at this time, so we could accept
> your contributions without any restrictions. If you are willing to
> start the paperwork now, I will send you the form to fill and the
> instructions to go with it.
Do I understand correctly that this patch could be installed now
with Copyright-paperwork-exempt?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance
2024-07-07 16:51 ` Juri Linkov
@ 2024-07-07 17:33 ` Eli Zaretskii
2024-07-07 18:24 ` Juri Linkov
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-07-07 17:33 UTC (permalink / raw)
To: Juri Linkov; +Cc: 71958, execvy
> From: Juri Linkov <juri@linkov.net>
> Cc: Eval Exec <execvy@gmail.com>, 71958@debbugs.gnu.org
> Date: Sun, 07 Jul 2024 19:51:10 +0300
>
> >> From: Eval Exec <execvy@gmail.com>
> >> Date: Fri, 5 Jul 2024 19:11:54 +0800
> >
> > I'll leave it to Juri to review the code and comment, but
> > just minor nits on your commit log message:
>
> I confirm this is the right fix.
> Thanks to Eval Exec.
>
> > In addition, I'd encourage you to start your legal paperwork of
> > assigning the copyright to the FSF at this time, so we could accept
> > your contributions without any restrictions. If you are willing to
> > start the paperwork now, I will send you the form to fill and the
> > instructions to go with it.
>
> Do I understand correctly that this patch could be installed now
> with Copyright-paperwork-exempt?
Yes. Please also mention the bug number in the log message when you
commit.
Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance
2024-07-07 17:33 ` Eli Zaretskii
@ 2024-07-07 18:24 ` Juri Linkov
2024-07-09 2:46 ` Richard Stallman
2024-07-13 2:21 ` Richard Stallman
2 siblings, 0 replies; 7+ messages in thread
From: Juri Linkov @ 2024-07-07 18:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 71958, execvy
close 71958 30.0.60
thanks
>> > I'll leave it to Juri to review the code and comment, but
>> > just minor nits on your commit log message:
>>
>> I confirm this is the right fix.
>> Thanks to Eval Exec.
>>
>> > In addition, I'd encourage you to start your legal paperwork of
>> > assigning the copyright to the FSF at this time, so we could accept
>> > your contributions without any restrictions. If you are willing to
>> > start the paperwork now, I will send you the form to fill and the
>> > instructions to go with it.
>>
>> Do I understand correctly that this patch could be installed now
>> with Copyright-paperwork-exempt?
>
> Yes. Please also mention the bug number in the log message when you
> commit.
Ok, so now done.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance
2024-07-07 17:33 ` Eli Zaretskii
2024-07-07 18:24 ` Juri Linkov
@ 2024-07-09 2:46 ` Richard Stallman
2024-07-13 2:21 ` Richard Stallman
2 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2024-07-09 2:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 71958, execvy, juri
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
How are you feeling these days?
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance
2024-07-07 17:33 ` Eli Zaretskii
2024-07-07 18:24 ` Juri Linkov
2024-07-09 2:46 ` Richard Stallman
@ 2024-07-13 2:21 ` Richard Stallman
2 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2024-07-13 2:21 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 71958, execvy, juri
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
I meant to send "How are you feeling these days?" as a reply to a
different message. Sorry for the confusion.
Alas, I can't find the message it was meant as a reply to.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-07-13 2:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05 11:11 bug#71958: [PATCH] Improve `tab-line-tabs-fixed-window-buffers` sorting performance Eval Exec
2024-07-06 6:23 ` Eli Zaretskii
2024-07-07 16:51 ` Juri Linkov
2024-07-07 17:33 ` Eli Zaretskii
2024-07-07 18:24 ` Juri Linkov
2024-07-09 2:46 ` Richard Stallman
2024-07-13 2:21 ` Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).