emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 64109fcae7 2/3: indent-for-tab-command: Deal with large point


From: Mattias Engdegård
Subject: Re: master 64109fcae7 2/3: indent-for-tab-command: Deal with large point or modiff values.
Date: Mon, 17 Jan 2022 22:35:23 +0100

17 jan. 2022 kl. 20.55 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

> `eq` can be marginally faster, but the difference is so small that it's
> only noticeable when it's called from C in a tight loop, like maybe when
> comparing `memq` and `memql` but not when calling `eq` vs `eql` from
> ELisp where the actual overhead of interpreting the byte code is large
> enough to dwarf the difference of the execution of the op itself.

That's not quite true; the fact that `eq` has a byte-code and `eql` doesn't can 
be quite noticeable. Consider this very reasonable function for finding an 
element in a vector:

(defun vmemq (x v)
  (let ((n (length v))
        (i 0))
    (while (and (< i n) (not (eq (aref v i) x)))
      (setq i (1+ i)))
    (and (< i n) i)))

Replace `eq` with `eql` and execution time goes up 76 %, which is substantial 
by any measure. (Emacs 28, on vectors 1000 elements long.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]