[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 71668fe 003/316: Speed up -table-flat
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 71668fe 003/316: Speed up -table-flat |
Date: |
Mon, 15 Feb 2021 15:57:13 -0500 (EST) |
branch: externals/dash
commit 71668fe6ac901092c7afd13455812a73d1e04c57
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Speed up -table-flat
A proposed change from Stefan Monnier. He writes:
The patch speeds up -table-flat by 25% (worst-case) and a factor
4x (base case) in my tests, where `fn' was the addition function.
I'll leave it as an exercise to adapt this idea to -table ;-)
---
dash.el | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/dash.el b/dash.el
index aceff8b9..7cb844c 100644
--- a/dash.el
+++ b/dash.el
@@ -1102,14 +1102,18 @@ of the result. This is equivalent to calling:
but the implementation here is much more efficient.
See also: `-flatten-n', `-table'"
- (let ((restore-lists (copy-sequence lists))
- (last-list (last lists))
- re)
- (while (car last-list)
- (push (apply fn (-map 'car lists)) re)
- (pop (car lists))
- (dash--table-carry lists restore-lists))
- (nreverse re)))
+ (when lists ;Just in case.
+ (let* ((list1 (pop lists))
+ (restore-lists (copy-sequence lists))
+ (last-list (last lists))
+ re)
+ (while (car last-list)
+ (let ((tail (-map #'car lists)))
+ (dolist (head list1)
+ (push (apply fn head tail) re)))
+ (pop (car lists))
+ (dash--table-carry lists restore-lists))
+ (nreverse re))))
(defun -partial (fn &rest args)
"Take a function FN and fewer than the normal arguments to FN,
- [elpa] externals/dash updated (c287454 -> 0e97578), ELPA Syncer, 2021/02/15
- [elpa] externals/dash 277d6ed 002/316: Merge pull request #165 from phillord/fix/table-performance, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7881268 001/316: Prefer make-list over --map., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 71668fe 003/316: Speed up -table-flat,
ELPA Syncer <=
- [elpa] externals/dash a3cd1ac 004/316: Alias `-zip-pair`, prepare for breaking change, ELPA Syncer, 2021/02/15
- [elpa] externals/dash fec6f54 007/316: Release 2.12.1, ELPA Syncer, 2021/02/15
- [elpa] externals/dash b6e1041 010/316: Fix broken GH profile link in README, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 174187f 005/316: Add lexical binding pragma to dash.el, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 22e494a 008/316: Update MELPA URLs, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0d84c0f 009/316: Merge pull request #167 from syohex/update-url, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 8a46d3c 013/316: [#170] Add a note about -keep on -filter., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 81b15c5 006/316: Fix: The upcoming breaking change is 3.0, not 2.0, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 6484fb5 012/316: Merge pull request #168 from camsaul/patch-2, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 0272e8b 017/316: [Fix #158] -map-last does not modify input list., ELPA Syncer, 2021/02/15