Re: diff. betw. equal and eq on simbols
- From: Pascal Costanza <pc@xxxxxxxxx>
- Date: Mon, 31 Oct 2005 13:28:15 +0100
Nikola Skoric wrote:
I've been reading "COMMON LISP: A Gentle Introduction to Symbolic Computation" by David S. Touretzky, and came across a section where he describes difference between eq and equal. And, says "Due to its greater efficiency, programmers often use EQ instead of EQUAL when symbols are being compared." Now, why would eq be more efficient than equal when comparing only one symbol?
EQ doesn't need to perform checks of which types the arguments are, but can just blindly perform a comparison of the pointers itself. EQL has to perform a test whether the arguments are numers, characters or other objects, and EQUAL has to perform even more checks in the general case. The loss of efficiency is due to the overhead spent on the type tests.
Pascal
-- My website: http://p-cos.net Closer to MOP & ContextL: http://common-lisp.net/project/closer/ .
- Prev by Date: Re: Lisp in embedded systems?
- Next by Date: Re: diff. betw. equal and eq on simbols
- Previous by thread: Re: diff. betw. equal and eq on simbols
- Next by thread: Re: diff. betw. equal and eq on simbols
- Index(es):
Relevant Pages
|