Since it appears there's no performance degradation, can we merge this? If others would like to do some testing, that'd be great. On Mon, Apr 9, 2018 at 8:33 AM, Tianxiang Xiong wrote: > I also figured out what the `(progn ... t)` pattern does. Here's a > macroexpansion w/ it: > > (macroexpand-1 '(cl-loop for i in '(1 2 3) collect i)) > > (cl-block nil > (let* > ((--cl-var-- > '(1 2 3)) > (i nil) > (--cl-var-- nil)) > (while > (consp --cl-var--) > (setq i > (car --cl-var--)) > (push i --cl-var--) > (setq --cl-var-- > (cdr --cl-var--))) > (nreverse --cl-var--))) > > And one w/out it: > > (macroexpand-1 '(cl-loop for i in '(1 2 3) collect i)) > > (cl-block nil > (let* > ((--cl-var-- > '(1 2 3)) > (i nil) > (--cl-var-- nil)) > (while > (and > (consp --cl-var--) > (progn > (setq i > (car --cl-var--)) > (push i --cl-var--))) > (setq --cl-var-- > (cdr --cl-var--))) > (nreverse --cl-var--))) > > Apparently `cl--loop-build-ands` uses this pattern > > to determine whether clauses go into an `and` or not 🤷. Of course 🙄! > > > On Mon, Apr 9, 2018 at 8:28 AM, Tianxiang Xiong > wrote: > >> Here's the result of `benchmark-run` on the new code: >> >> (benchmark-run 10 (cl-loop for i in (number-sequence 1 1E6) >> collect i)) >> >> ;; => (10.488984668 6 3.555157208999999) >> >> and old code: >> >> (benchmark-run 10 (cl-loop for i in (number-sequence 1 1E6) >> collect i)) >> >> ;; => (14.876455789000001 25 2.328459104999999) >> >> So there actually seems to be an improvement due to less GC. >> >> On Mon, Apr 9, 2018 at 5:22 AM, Basil L. Contovounesios >> wrote: >> >>> Tianxiang Xiong writes: >>> >>> > Is there a function to easily time operations in Emacs Lisp? Something >>> > like Clojure's `core/time`? >>> >>> There are the macros benchmark-run and benchmark-run-compiled, as >>> mentioned under (info "(elisp) Profiling"). >>> >>> -- >>> Basil >>> >> >> >