|
| From: | Dmitry Gutov |
| Subject: | Re: What's missing in ELisp that makes people want to use cl-lib? |
| Date: | Tue, 14 Nov 2023 04:48:11 +0200 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
On 14/11/2023 04:44, João Távora wrote:
On Tue, Nov 14, 2023 at 2:27 AM João Távora <joaotavora@gmail.com <mailto:joaotavora@gmail.com>> wrote:The case in the CL world against generic functions' performance is often not that the dispatch is slow, but that That said, it still matters, of course. Here's your non-destructive seq-difference-3 but with many small lists: (setq cc (make-list 12 "blabla")) (setq list2 (make-list 12 "shooveedoowaa"))
;; (4.225398191 31 2.3103362619999928) (benchmark-run 1000000 (cl-set-difference cc list2 :test #'equal)) ;; (6.959332908 56 4.235225837999991) (benchmark-run 1000000 (seq-difference-3 cc list2))
And if the list has just 1 element (or zero?), the gap would be even larger. Yes, generic dispatch has a cost.
Only seeing a 1.6x difference here is a nice surprise, actually.
And of course the destructive version still wins by 10x ;; (0.676608019 4 0.26997238299998116) (benchmark-run 1000000 (cl-nset-difference cc list2 :test #'equal))
No doubt.
| [Prev in Thread] | Current Thread | [Next in Thread] |