[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scm_sloppy_memq
From: |
Mikael Djurfeldt |
Subject: |
scm_sloppy_memq |
Date: |
Thu, 30 Nov 2000 18:13:05 +0100 |
I saw that you have replaced the use of scm_sloppy_memq in some places
by scm_memq. (Did you do the same with scm_sloppy_assq?)
Why did you do this?
The name "scm_sloppy_memq" and perhaps some of its semantics
(returning SCM_EOL) could be discussed, but I think we should have
efficient C-level versions of scm_memq and scm_assq for internal use
in the implementation of libguile.
scm_memq has an execution time which is on average a factor 3 greater
than scm_sloppy_memq. This is because of the verification that arg 2
is a list. It is not very good to unnecessarily loop through the
entire list in situations where we already know that arg 2 is a list.
In fact, some algorithms rely on scm_sloppy_memq being able to find
the common case in the beginning of the list. In those cases the
effect of replacing scm_sloppy_memq with scm_memq actually causes a
change in time complexity by one order of magnitude...
Best regards,
Mikael
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scm_sloppy_memq,
Mikael Djurfeldt <=