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 <contovob@tcd.ie> wrote:
Tianxiang Xiong <tianxiang.xiong@gmail.com> 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