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

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

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


From: Jean Louis
Subject: Re: Emacs 30.0 warning from `cl-pushnew' and `memql'
Date: Wed, 28 Dec 2022 23:24:55 +0300
User-agent: Mutt/2.2.9+54 (af2080d) (2022-11-21)

* Michael Heerdegen <michael_heerdegen@web.de> [2022-12-28 15:01]:
> I think the interpretation of the question "Could there be a better
> default comparison function?", in the sense that `eql' is a bit nicer
> than `eq' for specific value types, is valid, especially when
> considering that `cl-pushnew' is often used for configuration stuff or
> other purposes where speed is not crucial.

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))


By the way, how do I go to make this right?
-------------------------------------------

(setq my-list '())
(benchmark 1000 (setq my-list (cons "My string" my-list))) 

as it gives error that "My string" is invalid function.

Do I need to do something like:

(benchmark 1000 (prog1 nil 
                  (setq my-list (cons (quote "Word") my-list))))


(benchmark 10000000 (prog1 nil 
                  (setq my-list (cons (quote "Word") my-list)))) ➜ "Elapsed 
time: 0.823678s"

(benchmark 10000000 (prog1 nil 
                  (push "Word" my-list))) ➜ "Elapsed time: 0.824388s"

So there is no much difference apparently.


-- 
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]