diff options
| author | Stefan Kangas | 2023-09-04 21:28:33 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2023-09-04 21:28:33 +0200 |
| commit | 82cc1f4fda19a635cc29577a4da051cf3e062afe (patch) | |
| tree | 853dbdeb056f44805d2056c751eede0807f80513 | |
| parent | 2cefcb2f7900e9d19c801cde2b9a29731c986df9 (diff) | |
| download | emacs-82cc1f4fda19a635cc29577a4da051cf3e062afe.tar.gz emacs-82cc1f4fda19a635cc29577a4da051cf3e062afe.zip | |
Revert use of seq-count in shr-count
* lisp/net/shr.el (shr-count): Prefer handwritten code to using
'seq-count', as it's more performant.
Problem reported by Mattias EngdegÄrd <mattiase@acm.org>.
| -rw-r--r-- | lisp/net/shr.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 84033c31ef4..645e1cc51e5 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -2617,10 +2617,13 @@ flags that control whether to collect or render objects." | |||
| 2617 | columns)) | 2617 | columns)) |
| 2618 | 2618 | ||
| 2619 | (defun shr-count (dom elem) | 2619 | (defun shr-count (dom elem) |
| 2620 | (seq-count (lambda (sub) | 2620 | ;; This is faster than `seq-count', and shr can use it. |
| 2621 | (and (not (stringp sub)) | 2621 | (let ((i 0)) |
| 2622 | (eq (dom-tag sub) elem))) | 2622 | (dolist (sub (dom-children dom)) |
| 2623 | (dom-children dom))) | 2623 | (when (and (not (stringp sub)) |
| 2624 | (eq (dom-tag sub) elem)) | ||
| 2625 | (setq i (1+ i)))) | ||
| 2626 | i)) | ||
| 2624 | 2627 | ||
| 2625 | (defun shr-max-columns (dom) | 2628 | (defun shr-max-columns (dom) |
| 2626 | (let ((max 0) | 2629 | (let ((max 0) |