(nthcdr most-positive-fixnum (list 1 2 3)) very slow
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
(nthcdr most-positive-
(nthcdr (1+ most-positive-
(nth most-positive-
(nth (1+ most-positive-
(time (nthcdr 10000000000 (list 1 2 3))) -> 13 seconds on my machine, so the calculation probably returns eventually
The follwing fix for src/code/list.lisp seems to solve this, running the ansi-tests before and after gives the same result.
diff src/code/list.lisp src/code/
204a205,206
> (when (null result)
> (return nil))
250c252
< ((not (plusp i)) result))))
---
> ((or (not (plusp i)) (null result)) result))))
* (lisp-implement
"1.5.8"
* (machine-type)
"X86-64"
* (machine-version)
"Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz"
* (print *features*)
(:QUICKLISP :SB-BSD-
:ASDF :OS-MACOSX :OS-UNIX :NON-BASE-
:64-BIT :ALIEN-CALLBACKS :ANSI-CL :AVX2 :BSD :C-STACK-
:CALL-SYMBOL :COMMON-LISP :COMPACT-
:CYCLE-COUNTER :DARWIN :FP-AND-
:IMMOBILE-CODE :IMMOBILE-SPACE :INODE64 :INTEGER-EQL-VOP :LINKAGE-TABLE
:LITTLE-ENDIAN :MACH-EXCEPTION
:OS-PROVIDES-
:OS-PROVIDES-
:SB-EVAL :SB-LDB :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SIMD-PACK-256
:SB-SOURCE-
:STACK-
:STACK-
:UNDEFINED-
uname -a
Darwin karsten-
But that slows down the normal use case.