branch: externals/dash
commit 578428abfe03c3c7d9c1ecc73d2f49747bb64cb4
Author: Paul Pogonyshev <pogonys...@gmail.com>
Commit: Matus Goljer <matus.gol...@gmail.com>

    Add some implementation commentary to '-each-r'.
---
 dash.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dash.el b/dash.el
index 33cf56b..8d1d9a6 100644
--- a/dash.el
+++ b/dash.el
@@ -130,6 +130,11 @@ Return nil, used for side-effects only."
   (declare (debug (form body))
            (indent 1))
   (let ((v (make-symbol "vector")))
+    ;; Implementation note: building vector is considerably faster
+    ;; than building a reversed list (vector takes less memory, so
+    ;; there is less GC), plus length comes naturally.  In-place
+    ;; 'nreverse' would be faster still, but BODY would be able to see
+    ;; that, even if modification was reversed before we return.
     `(let* ((,v (vconcat ,list))
             (it-index (length ,v))
             it)

Reply via email to