Reimplement gnus-thread-header in Lisp

* lisp/gnus/gnus-sum.el (gnus-thread-header):
Replace lovingly hand-crafted assembler code with plain Lisp.
With lexical binding the difference is unlikely to be detectable.
This commit is contained in:
Mattias Engdegård
2021-12-11 21:59:13 +01:00
parent d56b0b4e6b
commit 36cd4f5d81

View File

@@ -5001,23 +5001,13 @@ If LINE, insert the rebuilt thread starting on line LINE."
gnus-article-sort-functions)))
(gnus-message 7 "Sorting articles...done"))))
;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
(defmacro gnus-thread-header (thread)
"Return header of first article in THREAD.
Note that THREAD must never, ever be anything else than a variable -
using some other form will lead to serious barfage."
(or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
;; (8% speedup to gnus-summary-prepare, just for fun :-)
(cond
((and (boundp 'lexical-binding) lexical-binding)
;; FIXME: This version could be a "defsubst" rather than a macro.
`(#[257 "\211:\203\16\0\211@;\203\15\0A@@\207"
[] 2]
,thread))
(t
;; Not sure how XEmacs handles these things, so let's keep the old code.
(list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
(vector thread) 2))))
(defsubst gnus-thread-header (thread)
"Return header of first article in THREAD."
(if (consp thread)
(car (if (stringp (car thread))
(cadr thread)
thread))
thread))
(defsubst gnus-article-sort-by-number (h1 h2)
"Sort articles by article number."