* Perferr cond over case?
@ 2009-10-11 12:09 Nordlöw
2009-10-11 18:17 ` Pascal J. Bourguignon
0 siblings, 1 reply; 3+ messages in thread
From: Nordlöw @ 2009-10-11 12:09 UTC (permalink / raw)
To: help-gnu-emacs
Does the use of the cl macro case() incurr some loss of performance
compare to using cond() instead?
/Nordlöw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Perferr cond over case?
2009-10-11 12:09 Perferr cond over case? Nordlöw
@ 2009-10-11 18:17 ` Pascal J. Bourguignon
2009-10-12 8:03 ` David Kastrup
0 siblings, 1 reply; 3+ messages in thread
From: Pascal J. Bourguignon @ 2009-10-11 18:17 UTC (permalink / raw)
To: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
> Does the use of the cl macro case() incurr some loss of performance
> compare to using cond() instead?
(macroexpand '(case (* 2 2 2 2 3)
(10 'one)
((24 42) 'two)
((3 33) 'three)
(otherwise 'unknown)))
-->
(let ((--cl-var-- (* 2 2 2 2 3)))
(cond ((eql --cl-var-- (quote 10)) (quote one))
((member* --cl-var-- (quote (24 42))) (quote two))
((member* --cl-var-- (quote (3 33))) (quote three))
(t (quote unknown))))
What do you think?
--
__Pascal Bourguignon__
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Perferr cond over case?
2009-10-11 18:17 ` Pascal J. Bourguignon
@ 2009-10-12 8:03 ` David Kastrup
0 siblings, 0 replies; 3+ messages in thread
From: David Kastrup @ 2009-10-12 8:03 UTC (permalink / raw)
To: help-gnu-emacs
pjb@informatimago.com (Pascal J. Bourguignon) writes:
> Nordlöw <per.nordlow@gmail.com> writes:
>
>> Does the use of the cl macro case() incurr some loss of performance
>> compare to using cond() instead?
>
> (macroexpand '(case (* 2 2 2 2 3)
> (10 'one)
> ((24 42) 'two)
> ((3 33) 'three)
> (otherwise 'unknown)))
> -->
> (let ((--cl-var-- (* 2 2 2 2 3)))
> (cond ((eql --cl-var-- (quote 10)) (quote one))
> ((member* --cl-var-- (quote (24 42))) (quote two))
> ((member* --cl-var-- (quote (3 33))) (quote three))
> (t (quote unknown))))
>
> What do you think?
Before or after byte compilation?
--
David Kastrup
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-12 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-11 12:09 Perferr cond over case? Nordlöw
2009-10-11 18:17 ` Pascal J. Bourguignon
2009-10-12 8:03 ` David Kastrup
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).