help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql'


From: Jean Louis
Subject: Re: [External] : Re: Emacs 30.0 warning from `cl-pushnew' and `memql'
Date: Thu, 29 Dec 2022 01:47:57 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* Drew Adams <drew.adams@oracle.com> [2022-12-29 00:24]:
> > Michael, what is the fastest way to add element on stack of the list
> > elements?
> > 
> > Let us say I am adding only strings, would this be faster than `push':
> > 
> > (setq my-list '())
> > (setq my-list (cons (quote "Word") my-list))
> 
> 
> I'm not Michael, but (push "Word" my-list) expands
> to just that code.  So no, neither is faster.
> 
> (macroexpand-1 '(push "Word" mylist))
> 
> ;; ==> (setq mylist (cons "Word" mylist))

Thanks.

> (And no reason to quote either () or a literal string.)

There was reason. See here:

(setq my-list '())
(benchmark 1000 (setq my-list (cons "Word" my-list)))

Debugger entered--Lisp error: (invalid-function "Word")
  ("Word")
  (closure (t) nil ("Word"))()
  benchmark-call((closure (t) nil ("Word")) 1000)
  benchmark(1000 ("Word"))
  eval((benchmark 1000 (setq my-list (cons "Word" my-list))) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

but then `benchmark` worked only first time, second time it gave
error.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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