Re: specialized array slower than unspecialized?



I've piled in lots of type declarations

(declaim (optimize speed))

....snipped..
No surprises there then.

Remember that when SBCL can't directly infer types, it treats all type
declarations as assertions to be checked, unless told not to.
http://www.sbcl.org/manual/Declarations-as-Assertions.html#Declarations-as-Assertions

So unless you explicitly optimise for speed, declarations act as a
debugging tool that may well slow your code further.

.



Relevant Pages

  • Re: Is the following behavior defined by the standard or implementation specific?
    ... SBCL using disassemble they seem to produce identical code but my quick ... (defun sss (x y) ... What you've told the compiler about SSS is that not ... strictly and precisely enforces all declarations as though they had ...
    (comp.lang.lisp)
  • Part 2 of Short Steps Toward Generic Programming: Specification Assertions
    ... uses of this first feature. ... Specification assertions: ... I like explicit declarations, so I propose the INFERRED attribute. ... the same and that K is a named constant with that value. ...
    (comp.lang.fortran)
  • Re: Use of macros for conditional compilation ?
    ... showed the access time to a structure to be two ... using generic functions that dispatch on types introduced by DEFSTRUCT. ... implementation (SBCL) some other questions raise themselves; ... single-float) declarations in defstructs can be really helpful when ...
    (comp.lang.lisp)
  • Re: NIL is not of type CONS
    ... In SBCL 1.0.12.34 it does, ... (typep nil 'cons) ... But you declared TT to have type CONS. ... CLISP does not check these declarations. ...
    (comp.lang.lisp)
  • Re: NIL is not of type CONS
    ... In SBCL 1.0.12.34 it does, ... (typep nil 'cons) ... But you declared TT to have type CONS. ... CLISP does not check these declarations. ...
    (comp.lang.lisp)