Re: [srfi-1] lset-difference too slow?
Matthias Radestock <[email protected]>
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
Marco, "Marco Bakera" <[email protected]> writes: > I experienced some problems running the following code. > > (require-extension (srfi 1)) > > (let ((test (time (lset-difference eq? > (iota 10000) > '(-1))))) > (cdr test)) > > First, it seems as if srfi-1 seems not to be loaded if followed by > some space character as in > (require-extension (srfi 1 )) That a) is impossible, and b) works fine for me. > On the other hand the implementation seems to be really slow as I got > results taking round about 300ms while the same code ran in S48 in > nearly no time. Is it possible there is a performance leak in there? > Or is this the price I have to pay intepreting scheme in java? Not sure. I had a quick look at the s48 implementation of srfi-1 and it appears to be close to the reference implementation, just like ours. If you have the time please do some more testing/profiling to figure out where all the time is going. Btw, you probably want to make that test an eqv? rather than eq? since eq? on numbers is not guaranteed to return #t for the equal numbers. Matthias.