diff --git a/src/lib/char/encoding/encoding.lisp b/src/lib/char/encoding/encoding.lisp index fd115f4..c1f1268 100644 --- a/src/lib/char/encoding/encoding.lisp +++ b/src/lib/char/encoding/encoding.lisp @@ -202,9 +202,9 @@ a CHARACTER-ENCONDING object, it is returned unmodified." ;;; object. (defmacro instantiate-concrete-mappings (&key (encodings (hash-table-keys *abstract-mappings*)) - (optimize '((speed 3) (debug 0) (compilation-speed 0))) - octet-seq-getter octet-seq-setter octet-seq-type - code-point-seq-getter code-point-seq-setter code-point-seq-type + (optimize '((speed 3) (debug 0) (compilation-speed 0))) + octet-seq-getter octet-seq-setter octet-seq-type + code-point-seq-getter code-point-seq-setter code-point-seq-type (instantiate-decoders t)) `(let ((ht (make-hash-table :test 'eq))) (declare (optimize ,@optimize) diff --git a/src/lib/char/string.lisp b/src/lib/char/string.lisp index cd49a46..d2d93e9 100644 --- a/src/lib/char/string.lisp +++ b/src/lib/char/string.lisp @@ -91,7 +91,6 @@ are less than UNICODE-CHAR-CODE-LIMIT." (defun string-to-u8 (string &key (encoding *default-character-encoding*) (start 0) end (use-bom :default) (errorp (not *suppress-character-coding-errors*))) - (declare (optimize (speed 3) (safety 2))) (let ((*suppress-character-coding-errors* (not errorp))) (etypecase string (simple-base-string @@ -189,24 +188,20 @@ are less than UNICODE-CHAR-CODE-LIMIT." vector-size-in-chars concatenate-strings-to-octets)) (defun standard-alpha-byte-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (<= #.(char-code #\A) byte #.(char-code #\Z)) (<= #.(char-code #\a) byte #.(char-code #\z)))) (defun standard-alpha-char-p (char) - (declare (type character char) - (optimize (speed 3) (safety 0))) + (declare (type character char)) (standard-alpha-byte-p (char-code char))) (defun standard-alphanumeric-p (char) - (declare (type character char) - (optimize (speed 3) (safety 0))) + (declare (type character char)) (or (digit-char-p char) (standard-alpha-char-p char))) (defun standard-alphanumeric-byte-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (<= #.(char-code #\0) byte #.(char-code #\9)) (standard-alpha-byte-p byte))) diff --git a/src/lib/codec/base64.lisp b/src/lib/codec/base64.lisp index d87b3a1..764b2ae 100644 --- a/src/lib/codec/base64.lisp +++ b/src/lib/codec/base64.lisp @@ -143,8 +143,7 @@ WHITESPACE can be one of: :signal - Signal a BAD-BASE64-CHARACTER condition using SIGNAL. :error - Signal a BAD-BASE64-CHARACTER condition using ERROR." hose sink) - (declare (optimize (speed 3) (safety 1)) - (type decode-table table) + (declare (type decode-table table) (type ,(ecase hose (:stream 'stream) (:string 'string)) @@ -308,8 +307,7 @@ WHITESPACE can be one of: (defun round-next-multiple (x n) "Round x up to the next highest multiple of n." - (declare (fixnum n) - (optimize (speed 3) (safety 1) (space 0))) + (declare (fixnum n)) (let ((remainder (mod x n))) (declare (fixnum remainder)) (if (zerop remainder) @@ -332,8 +330,7 @@ with a #\Newline." '((string input))) (:usb8-array '((type (array u8 (*)) input)))) - (fixnum columns) - (optimize (speed 3) (safety 1) (space 0))) + (fixnum columns)) (let ((pad (if uri *uri-pad-char* *pad-char*)) (encode-table (if uri *uri-encode-table* *encode-table*))) (declare (simple-string encode-table) @@ -489,8 +486,7 @@ with a #\Newline." (defun integer-to-base64-string (input &key (uri nil) (columns 0)) "Encode an integer to base64 format." (declare (integer input) - (fixnum columns) - (optimize (speed 3) (space 0) (safety 1))) + (fixnum columns)) (let ((pad (if uri *uri-pad-char* *pad-char*)) (encode-table (if uri *uri-encode-table* *encode-table*))) (declare (simple-string encode-table) @@ -548,8 +544,7 @@ with a #\Newline." (defun integer-to-base64-stream (input stream &key (uri nil) (columns 0)) "Encode an integer to base64 format." (declare (integer input) - (fixnum columns) - (optimize (speed 3) (space 0) (safety 1))) + (fixnum columns)) (let ((pad (if uri *uri-pad-char* *pad-char*)) (encode-table (if uri *uri-encode-table* *encode-table*))) (declare (simple-string encode-table) diff --git a/src/lib/codec/inflate.lisp b/src/lib/codec/inflate.lisp index 25bcf82..3ca5292 100644 --- a/src/lib/codec/inflate.lisp +++ b/src/lib/codec/inflate.lisp @@ -261,7 +261,6 @@ the input and the number of bytes written to the output." (decode-value (table state) (declare (type huffman-decode-table table)) (declare (type inflate-state state)) - (declare (optimize (speed 3))) (ensure-bits (hdt-bits table) state) (let ((bits (inflate-state-bits state))) (declare (type u32 bits)) diff --git a/src/lib/function.lisp b/src/lib/function.lisp index 0bcb799..f20369c 100644 --- a/src/lib/function.lisp +++ b/src/lib/function.lisp @@ -41,7 +41,6 @@ PLACES contains a function." functions in turn to its arguments, returning the primary value of the first predicate that returns true, without calling the remaining predicates. If none of the predicates returns true, NIL is returned." - (declare (optimize (speed 3) (safety 1) (debug 1))) (let ((predicate (ensure-function predicate)) (more-predicates (mapcar #'ensure-function more-predicates))) (lambda (&rest arguments) @@ -74,7 +73,6 @@ predicates returns false, returns the primary value of the last predicate." "Returns a function composed of FUNCTION and MORE-FUNCTIONS that applies its arguments to to each in turn, starting from the rightmost of MORE-FUNCTIONS, and then calling the next one with the primary value of the last." - (declare (optimize (speed 3) (safety 1) (debug 1))) (reduce (lambda (f g) (let ((f (ensure-function f)) (g (ensure-function g))) @@ -93,7 +91,6 @@ and then calling the next one with the primary value of the last." (funs (make-gensym-list (length args) "COMPOSE"))) `(let ,(loop for f in funs for arg in args collect `(,f (ensure-function ,arg))) - (declare (optimize (speed 3) (safety 1) (debug 1))) (lambda (&rest arguments) (declare (dynamic-extent arguments)) ,(compose-1 funs)))))) @@ -103,7 +100,6 @@ and then calling the next one with the primary value of the last." its arguments to each in turn, starting from the rightmost of MORE-FUNCTIONS, and then calling the next one with all the return values of the last." - (declare (optimize (speed 3) (safety 1) (debug 1))) (reduce (lambda (f g) (let ((f (ensure-function f)) (g (ensure-function g))) @@ -121,7 +117,6 @@ the last." (let* ((args (cons function more-functions)) (funs (make-gensym-list (length args) "MV-COMPOSE"))) `(let ,(mapcar #'list funs args) - (declare (optimize (speed 3) (safety 1) (debug 1))) (lambda (&rest arguments) (declare (dynamic-extent arguments)) ,(compose-1 funs)))))) @@ -131,7 +126,6 @@ the last." (defun curry (function &rest arguments) "Returns a function that applies ARGUMENTS and the arguments it is called with to FUNCTION." - (declare (optimize (speed 3) (safety 1))) (let ((fn (ensure-function function))) (lambda (&rest more) (declare (dynamic-extent more)) @@ -143,7 +137,6 @@ it is called with to FUNCTION." (fun (gensym "FUN"))) `(let ((,fun (ensure-function ,function)) ,@(mapcar #'list curries arguments)) - (declare (optimize (speed 3) (safety 1))) (lambda (&rest more) (declare (dynamic-extent more)) (apply ,fun ,@curries more))))) @@ -151,7 +144,6 @@ it is called with to FUNCTION." (defun rcurry (function &rest arguments) "Returns a function that applies the arguments it is called with and ARGUMENTS to FUNCTION." - (declare (optimize (speed 3) (safety 1))) (let ((fn (ensure-function function))) (lambda (&rest more) (declare (dynamic-extent more)) @@ -162,7 +154,6 @@ with and ARGUMENTS to FUNCTION." (fun (gensym "FUN"))) `(let ((,fun (ensure-function ,function)) ,@(mapcar #'list rcurries arguments)) - (declare (optimize (speed 3) (safety 1))) (lambda (&rest more) (declare (dynamic-extent more)) (multiple-value-call ,fun (values-list more) ,@rcurries))))) diff --git a/src/lib/list.lisp b/src/lib/list.lisp index 9f3c128..795472a 100644 --- a/src/lib/list.lisp +++ b/src/lib/list.lisp @@ -323,7 +323,6 @@ expected-type designator of a TYPE-ERROR." in the list designated by KEYS and values corresponding to them are removed. The returned property-list may share structure with the PLIST, but PLIST is not destructively modified. Keys are compared using EQ." - (declare (optimize (speed 3))) ;; FIXME: possible optimization: (remove-from-plist '(:x 0 :a 1 :b 2) :a) ;; could return the tail without consing up a new list. (loop for (key . rest) on plist by #'cddr diff --git a/src/lib/seq/vector.lisp b/src/lib/seq/vector.lisp index 7bf8d8b..e9377b6 100644 --- a/src/lib/seq/vector.lisp +++ b/src/lib/seq/vector.lisp @@ -13,8 +13,7 @@ split-vector-from-start split-vector-from-end)) (defun split-vector-from-end (position-fn vector start end count remove-empty-subseqs) - (declare (optimize (speed 3) (debug 0)) - (type (function (vector fixnum) (or null fixnum)) position-fn)) + (declare (type (function (vector fixnum) (or null fixnum)) position-fn)) (loop :with end = (or end (length vector)) :for right := end :then left @@ -30,8 +29,7 @@ :finally (return (values (nreverse subseqs) (1+ left))))) (defun split-vector-from-start (position-fn vector start end count remove-empty-subseqs) - (declare (optimize (speed 3) (debug 0)) - (type vector vector) + (declare (type vector vector) (type (function (vector fixnum) (or null fixnum)) position-fn)) (let ((length (length vector))) (loop diff --git a/src/lib/stream.lisp b/src/lib/stream.lisp index 2d5dfe1..18eb542 100644 --- a/src/lib/stream.lisp +++ b/src/lib/stream.lisp @@ -502,8 +502,7 @@ READ-BYTE." (let* ((pos (input-buffer-pos buffer)) (vec (input-buffer-vector buffer)) (vec-len (length vec))) - (declare (optimize (speed 3) (safety 1)) - (type ->u8 vec) + (declare (type ->u8 vec) (type fixnum pos vec-len new-pos)) ;; Only need to update if pos or new-pos is in stream range. (when-let ((stream-update-needed? (or (> pos vec-len) @@ -570,8 +569,7 @@ READ-BYTE." (defun fast-write-byte (byte output-buffer) (declare (type u8 byte) - (type output-buffer output-buffer) - (optimize (speed 3) (safety 1))) + (type output-buffer output-buffer)) (when (= (output-buffer-fill output-buffer) (array-dimension (output-buffer-vector output-buffer) 0)) (if (streamp (output-buffer-output output-buffer)) diff --git a/src/lib/uri.lisp b/src/lib/uri.lisp index 8ac1202..a820753 100644 --- a/src/lib/uri.lisp +++ b/src/lib/uri.lisp @@ -203,8 +203,7 @@ (t form)))) (defun parse-uri-string (data &key (start 0) end) - (declare (type simple-string data) - (optimize (speed 3) (safety 2))) + (declare (type simple-string data)) (let (scheme userinfo host port path query fragment (parse-start start) (parse-end (or end (length data)))) @@ -275,8 +274,7 @@ (values scheme userinfo host port path query fragment))) (defun parse-uri-byte-vector (data &key (start 0) end) - (declare (type ->u8 data) - (optimize (speed 3) (safety 2))) + (declare (type ->u8 data)) (let (scheme userinfo host port path query fragment (parse-start start) (parse-end (or end (length data)))) @@ -285,8 +283,7 @@ (declare (type ->u8 data)) (values (u8-to-string data :start start :end end))) (parse-integer-from-bv (data &key (start 0) end) - (declare (type fixnum start end) - (optimize (speed 3) (safety 2))) + (declare (type fixnum start end)) (when (= start end) (return-from parse-integer-from-bv nil)) (do ((i start (1+ i)) @@ -400,8 +397,7 @@ (defun ,fn-for-string (,data &key (,start 0) (,end (length ,data)) ,@other-args) (declare (type simple-string ,data) - (type fixnum ,start ,end) - (optimize (speed 3) (safety 2))) + (type fixnum ,start ,end)) (macrolet ((char=* (char1 char2) `(char= ,char1 ,char2)) (char-code* (char) @@ -417,8 +413,7 @@ (defun ,fn-for-byte-vector (,data &key (,start 0) (,end (length ,data)) ,@other-args) (declare (type ->u8 ,data) - (type fixnum ,start ,end) - (optimize (speed 3) (safety 2))) + (type fixnum ,start ,end)) (macrolet ((char=* (byte char) `(= ,byte ,(char-code char))) (char-code* (byte) @@ -433,16 +428,14 @@ ,@body))))))))) (defun scheme-char-p (char) - (declare (type character char) - (optimize (speed 3) (safety 0))) + (declare (type character char)) (or (standard-alphanumeric-p char) (char= char #\+) (char= char #\-) (char= char #\.))) (defun scheme-byte-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (standard-alphanumeric-byte-p byte) (= byte (char-code #\+)) (= byte (char-code #\-)) @@ -584,28 +577,24 @@ port-start port-end)))) (defun path-char-p (char) - (declare (type character char) - (optimize (speed 3) (safety 0))) + (declare (type character char)) (let ((byte (char-code char))) (and (< byte 128) (or (= (aref +uri-char+ byte) 1) (= byte #.(char-code #\/)))))) (defun path-byte-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (= (aref +uri-char+ byte) 1) (= byte (char-code #\/)))) (defun query-char-p (char) - (declare (type character char) - (optimize (speed 3) (safety 0))) + (declare (type character char)) (or (path-char-p char) (char= char #\?))) (defun query-byte-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (path-byte-p byte) (= byte (char-code #\?)))) @@ -654,13 +643,11 @@ (defun parse-path-string (data &key (start 0) (end (length data))) (declare (type simple-string data) - (optimize (speed 3) (safety 2)) #+sbcl (sb-ext:muffle-conditions sb-ext:compiler-note)) (parse-until-string (#\? #\#) data :start start :end end)) (defun parse-path-byte-vector (data &key (start 0) (end (length data))) (declare (type ->u8 data) - (optimize (speed 3) (safety 2)) #+sbcl (sb-ext:muffle-conditions sb-ext:compiler-note)) (parse-until-byte-vector (#\? #\#) data :start start :end end)) @@ -684,16 +671,14 @@ (defun parse-query-string (data &key (start 0) (end (length data))) (declare (type simple-string data) - (type fixnum start end) - (optimize (speed 3) (safety 2))) + (type fixnum start end)) (let ((?-pos (position #\? data :start start :end end))) (when ?-pos (parse-until-string (#\#) data :start (1+ (the fixnum ?-pos)) :end end)))) (defun parse-query-byte-vector (data &key (start 0) (end (length data))) (declare (type ->u8 data) - (type fixnum start end) - (optimize (speed 3) (safety 2))) + (type fixnum start end)) (let ((?-pos (position #.(char-code #\?) data :start start :end end))) (when ?-pos (parse-until-byte-vector (#\#) data :start (1+ (the fixnum ?-pos)) :end end)))) @@ -716,8 +701,7 @@ (defun parse-fragment-string (data &key (start 0) (end (length data))) (declare (type simple-string data) - (type fixnum start end) - (optimize (speed 3) (safety 2))) + (type fixnum start end)) (let ((|#-pos| (position #\# data :start start :end end))) @@ -726,8 +710,7 @@ (defun parse-fragment-byte-vector (data &key (start 0) (end (length data))) (declare (type ->u8 data) - (type fixnum start end) - (optimize (speed 3) (safety 2))) + (type fixnum start end)) (let ((|#-pos| (position #\# data :start start :end end @@ -737,8 +720,7 @@ (declaim (ftype (function (character) (unsigned-byte 4)) hexdigit-to-integer)) (defun hexdigit-to-integer (char) - (declare (type character char) - (optimize (speed 3) (safety 0))) + (declare (type character char)) (let ((code (char-code char))) (declare (type fixnum code)) (cond @@ -765,7 +747,6 @@ (declare (type integer end i) (type ->u8 buffer)) (flet ((write-to-buffer (byte) - (declare (optimize (speed 3) (safety 0))) (setf (aref buffer i) byte) (incf i))) (with-array-parsing (char p data start end (and (not (stringp data)) @@ -814,8 +795,7 @@ (lenient nil)) (declare (type (or string ->u8) data) (type integer start) - (type character delimiter) - (optimize (speed 3) (safety 2))) + (type character delimiter)) (let ((end (or end (length data))) (start-mark nil) (=-mark nil)) @@ -903,8 +883,7 @@ ary)) (defun integer-to-hexdigit (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (let ((res (make-string 2))) (multiple-value-bind (quotient remainder) (floor byte 16) @@ -913,8 +892,7 @@ res)) (defun unreservedp (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (<= (char-code #\A) byte (char-code #\Z)) (<= (char-code #\a) byte (char-code #\z)) (<= (char-code #\0) byte (char-code #\9)) @@ -935,8 +913,7 @@ end space-to-plus) (declare (type (or string ->u8) data) - (type integer start) - (optimize (speed 3) (safety 2))) + (type integer start)) (let* ((octets (if (stringp data) (lib.char:string-to-u8 data :encoding encoding :start start :end end) data)) @@ -976,7 +953,6 @@ (defun url-encode-params (params-alist &key (encoding lib.char:*default-character-encoding*) space-to-plus) - (declare (optimize (speed 3))) (check-type params-alist list) (with-output-to-string (s) (loop for ((field . value) . rest) on params-alist do @@ -1050,8 +1026,7 @@ (host uri)) (defun ipv4-addr-p (host) - (declare (optimize (speed 3) (safety 2)) - #+sbcl (sb-ext:muffle-conditions sb-ext:compiler-note)) + (declare (sb-ext:muffle-conditions sb-ext:compiler-note)) (check-type host string) (flet ((read-byte-string (string start) (declare (type fixnum start)) @@ -1098,8 +1073,7 @@ host)) (defun ipv6-addr-p (host) - (declare (optimize (speed 3) (safety 2)) - #+sbcl (sb-ext:muffle-conditions sb-ext:compiler-note)) + (declare (sb-ext:muffle-conditions sb-ext:compiler-note)) (check-type host string) (when (= (length host) 0) (return-from ipv6-addr-p nil)) diff --git a/src/net/http/parser.lisp b/src/net/http/parser.lisp index 4edc9b8..8169c57 100644 --- a/src/net/http/parser.lisp +++ b/src/net/http/parser.lisp @@ -293,7 +293,7 @@ `(or (advance* ,step) (go :eof))) (advance* (&optional (step 1)) - `(locally (declare (optimize (speed 3) (safety 0) (debug 0) (compilation-speed 0))) + `(locally (declare (optimize (compilation-speed 0))) (incf ,',p ,step) ,@(if (eql step 0) () @@ -308,7 +308,7 @@ (go :eof))) (advance-to* (to) (once-only (to) - `(locally (declare (optimize (speed 3) (safety 0) (debug 0) (compilation-speed 0))) + `(locally (declare (optimize (compilation-speed 0))) (check-type ,to fixnum) (setq ,',p ,to) (if (<= ,',end ,',p) @@ -319,7 +319,7 @@ t))))) (skip (&rest elems) (check-skip-elems elems) - `(locally (declare (optimize (speed 3) (safety 0) (debug 0) (compilation-speed 0))) + `(locally (declare (optimize (compilation-speed 0))) (if (skip-conditions ,',elem ,elems) (advance) (error 'match-failed @@ -327,7 +327,7 @@ :expected ',elems)))) (skip* (&rest elems) (check-skip-elems elems) - `(locally (declare (optimize (speed 3) (safety 0) (debug 0) (compilation-speed 0))) + `(locally (declare (optimize (compilation-speed 0))) (unless (eofp) (loop (unless (skip-conditions ,',elem ,elems) @@ -339,7 +339,7 @@ (skip* ,@elems))) (skip? (&rest elems) (check-skip-elems elems) - `(locally (declare (optimize (speed 3) (safety 0) (debug 0) (compilation-speed 0))) + `(locally (declare (optimize (compilation-speed 0))) (when (skip-conditions ,',elem ,elems) (or (advance*) (go :eof))))) (skip-until (fn) @@ -391,11 +391,9 @@ ,@macros) #+sbcl (declare (sb-ext:muffle-conditions sb-ext:code-deletion-note)) (labels ((eofp () - (declare (optimize (speed 3) (safety 0) (debug 0))) (<= ,end ,p)) (current () (get-elem ,elem)) (peek (&key eof-value) - (declare (optimize (speed 3) (safety 0) (debug 0))) (let ((len (length ,data))) (declare (type fixnum len)) (if (or (eofp) (>= ,p (- ,end 1)) (= ,p (- len 1))) @@ -613,25 +611,21 @@ ;; FIXME repetitious (defun digit-byte-char-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (<= #.(char-code #\0) byte #.(char-code #\9))) (declaim (ftype (function (u8) fixnum) digit-byte-char-to-integer)) (defun digit-byte-char-to-integer (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (the fixnum (- byte #.(char-code #\0)))) (defun alpha-byte-char-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (<= #.(char-code #\A) byte #.(char-code #\Z)) (<= #.(char-code #\a) byte #.(char-code #\z)))) (defun alpha-byte-char-to-lower-char (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (the character (cond ((<= #.(char-code #\A) byte #.(char-code #\Z)) @@ -645,8 +639,7 @@ (digit-byte-char-p byte))) (defun mark-byte-char-p (byte) - (declare (type u8 byte) - (optimize (speed 3) (safety 0))) + (declare (type u8 byte)) (or (= byte #.(char-code #\-)) (= byte #.(char-code #\_)) (= byte #.(char-code #\.)) @@ -660,8 +653,7 @@ (declaim (ftype (function (u8) u8) byte-to-ascii-lower) (inline byte-to-ascii-lower)) (defun byte-to-ascii-lower (x) - (declare (type u8 x) - (optimize (speed 3) (safety 0))) + (declare (type u8 x)) (if (<= #.(char-code #\A) x #.(char-code #\Z)) (- x #.(- (char-code #\A) (char-code #\a))) x)) @@ -669,8 +661,7 @@ (declaim (inline ascii-octets-to-string)) (defun ascii-octets-to-string (octets &key (start 0) (end (length octets))) (declare (type simple-byte-vector octets) - (type (unsigned-byte 64) start end) - (optimize (speed 3) (safety 0))) + (type (unsigned-byte 64) start end)) (let* ((len (the (unsigned-byte 64) (- end start))) (string (make-string len :element-type 'character))) (declare (type (unsigned-byte 64) len) @@ -684,8 +675,7 @@ (declaim (inline ascii-octets-to-lower-string)) (defun ascii-octets-to-lower-string (octets &key (start 0) (end (length octets))) (declare (type simple-byte-vector octets) - (type (unsigned-byte 64) start end) - (optimize (speed 3) (safety 0))) + (type (unsigned-byte 64) start end)) (let* ((len (the (unsigned-byte 64) (- end start))) (string (make-string len :element-type 'character))) (declare (type (unsigned-byte 64) len) @@ -697,8 +687,7 @@ (code-char (byte-to-ascii-lower (aref octets j))))))) (defun append-byte-vectors (vec1 vec2) - (declare (type simple-byte-vector vec1 vec2) - (optimize (speed 3) (safety 0))) + (declare (type simple-byte-vector vec1 vec2)) (let* ((vec1-len (length vec1)) (vec2-len (length vec2)) (result (make-array (+ vec1-len vec2-len) @@ -961,15 +950,13 @@ (declaim (inline %whitespacep)) (defun %whitespacep (char) - (declare (type character char) - (optimize (speed 3) (safety 0))) + (declare (type character char)) (or (char= char #\Space) (char= char #\Tab))) (declaim (inline position-not-whitespace)) (defun position-not-whitespace (string &key from-end) - (declare (type #+ecl string #-ecl simple-string string) - (optimize (speed 3) (safety 0))) + (declare (type #+ecl string #-ecl simple-string string)) (let* ((len (length string)) (start (if from-end (1- len) 0)) (end (if from-end 0 (1- len))) @@ -983,8 +970,7 @@ (declaim (inline number-string-p)) (defun number-string-p (string) - (declare (type #+ecl string #-ecl simple-string string) - (optimize (speed 3) (safety 2))) + (declare (type simple-string string)) ;; empty string (when (zerop (length string)) (return-from number-string-p nil)) @@ -1772,8 +1758,7 @@ us a never-ending header that the application keeps buffering.") header-value-callback header-parameter-key-callback header-parameter-value-callback) - (declare (type simple-string data) - (optimize (speed 3) (safety 2))) + (declare (type simple-string data)) (let* ((header-name-mark 0) parameter-key-mark @@ -1795,7 +1780,6 @@ us a never-ending header that the application keeps buffering.") (setq char (aref data p)) (go ,state)))) (flet ((tokenp (char) - (declare (optimize (speed 3) (safety 0))) (let ((byte (char-code char))) (and (< byte 128) (not (char= (the character (aref +tokens+ byte)) #\Nul)))))) diff --git a/src/net/tls/ffi.lisp b/src/net/tls/ffi.lisp index d91ebc5..89644d3 100644 --- a/src/net/tls/ffi.lisp +++ b/src/net/tls/ffi.lisp @@ -1,7 +1,3 @@ -(eval-when (:compile-toplevel) - (declaim - (optimize (speed 3) (space 1) (safety 1) (debug 0) (compilation-speed 0)))) - (in-package :net.tls) ;;; Some lisps (CMUCL) fail when we try to define diff --git a/src/net/tls/init.lisp b/src/net/tls/init.lisp index 8594dae..fa892dd 100644 --- a/src/net/tls/init.lisp +++ b/src/net/tls/init.lisp @@ -1,7 +1,3 @@ -(eval-when (:compile-toplevel) - (declaim - (optimize (speed 3) (space 1) (safety 1) (debug 0) (compilation-speed 0)))) - (in-package :net.tls) ;;; Global state diff --git a/src/net/tls/ssl-funcall.lisp b/src/net/tls/ssl-funcall.lisp index 22cfd37..9e6e25b 100644 --- a/src/net/tls/ssl-funcall.lisp +++ b/src/net/tls/ssl-funcall.lisp @@ -1,7 +1,3 @@ -(eval-when (:compile-toplevel) - (declaim - (optimize (speed 3) (space 1) (safety 1) (debug 0) (compilation-speed 0)))) - (in-package :net.tls) ;;; Waiting for output to be possible diff --git a/src/net/tls/streams.lisp b/src/net/tls/streams.lisp index 434e682..78954ea 100644 --- a/src/net/tls/streams.lisp +++ b/src/net/tls/streams.lisp @@ -1,7 +1,3 @@ -(eval-when (:compile-toplevel) - (declaim - (optimize (speed 3) (space 1) (safety 1) (debug 0) (compilation-speed 0)))) - (in-package :net.tls) ;; Default Cipher List diff --git a/src/net/tls/x509.lisp b/src/net/tls/x509.lisp index c06d72c..dabe100 100644 --- a/src/net/tls/x509.lisp +++ b/src/net/tls/x509.lisp @@ -11,8 +11,7 @@ ASN1 string validation references: (defun copy-bytes-to-lisp-vector (src-ptr vector count) (declare (type ->u8 vector) - (type fixnum count) - (optimize (safety 0) (debug 0) (speed 3))) + (type fixnum count)) (dotimes (i count vector) (setf (aref vector i) (ffi:mem-aref src-ptr :unsigned-char i)))) @@ -24,17 +23,11 @@ ASN1 string validation references: vector)) (defun asn1-iastring-char-p (byte) - (declare (type u8 byte) - (optimize (speed 3) - (debug 0) - (safety 0))) + (declare (type u8 byte)) (< byte #x80)) (defun asn1-iastring-p (bytes) - (declare (type ->u8 bytes) - (optimize (speed 3) - (debug 0) - (safety 0))) + (declare (type ->u8 bytes)) (every #'asn1-iastring-char-p bytes)) (defmethod decode-asn1-string (asn1-string (type (eql +v-asn1-iastring+))) @@ -44,10 +37,7 @@ ASN1 string validation references: (error 'invalid-asn1-string :type '+v-asn1-iastring+)))) (defun asn1-printable-char-p (byte) - (declare (type u8 byte) - (optimize (speed 3) - (debug 0) - (safety 0))) + (declare (type u8 byte)) (cond ;; a-z ((and (>= byte #.(char-code #\a)) @@ -72,10 +62,7 @@ ASN1 string validation references: ((= byte #.(char-code #\?)) t))) (defun asn1-printable-string-p (bytes) - (declare (type ->u8 bytes) - (optimize (speed 3) - (debug 0) - (safety 0))) + (declare (type ->u8 bytes)) (every #'asn1-printable-char-p bytes)) (defmethod decode-asn1-string (asn1-string (type (eql +v-asn1-printablestring+))) @@ -100,18 +87,12 @@ ASN1 string validation references: (error 'invalid-asn1-string :type '+v-asn1-universalstring+))) (defun asn1-teletex-char-p (byte) - (declare (type u8 byte) - (optimize (speed 3) - (debug 0) - (safety 0))) + (declare (type u8 byte)) (and (>= byte #x20) (< byte #x80))) (defun asn1-teletex-string-p (bytes) - (declare (type ->u8 bytes) - (optimize (speed 3) - (debug 0) - (safety 0))) + (declare (type ->u8 bytes)) (every #'asn1-teletex-char-p bytes)) (defmethod decode-asn1-string (asn1-string (type (eql +v-asn1-teletexstring+))) diff --git a/src/sys/ffi/strings.lisp b/src/sys/ffi/strings.lisp index 5262fc7..1473d5a 100644 --- a/src/sys/ffi/strings.lisp +++ b/src/sys/ffi/strings.lisp @@ -79,7 +79,6 @@ ;;; TODO: tackle optimization notes. (defparameter *foreign-string-mappings* (instantiate-concrete-mappings - ;; :optimize ((speed 3) (debug 0) (compilation-speed 0) (safety 0)) :octet-seq-getter bget :octet-seq-setter bset :octet-seq-type foreign-pointer