Optimized read-http-line a bit in order to reduce gratuitous consing.
This commit is contained in:
@ -13,6 +13,30 @@
|
||||
;;;;
|
||||
;;;;
|
||||
|
||||
(defun read-http-line (stream)
|
||||
(declare (optimize (speed 3) (safety 0) (debug 0))
|
||||
(type stream stream))
|
||||
(let ((string (make-array 80 :element-type 'character :fill-pointer 0
|
||||
:adjustable t)))
|
||||
(declare (type string string))
|
||||
(do ((char (read-char stream) (read-char stream)))
|
||||
((char= char #\Newline) (coerce string 'simple-string))
|
||||
(declare (type character char))
|
||||
(unless (char= char #\Return)
|
||||
(vector-push-extend char string)))))
|
||||
|
||||
#+NIL
|
||||
(defun read-http-line (stream)
|
||||
(declare (optimize (speed 3) (safety 0) (debug 0))
|
||||
(type stream stream))
|
||||
(with-output-to-string (out)
|
||||
(do ((char (read-char stream) (read-char stream)))
|
||||
((char= char #\Newline))
|
||||
(declare (character char))
|
||||
(unless (char= char #\Return)
|
||||
(write-char char out)))))
|
||||
|
||||
#+NIL
|
||||
(defun read-http-line (stream)
|
||||
(let ((in-line (read-line stream nil nil)))
|
||||
(if in-line
|
||||
|
||||
Reference in New Issue
Block a user