Commit cdd4c29d authored by Stas Boukarev's avatar Stas Boukarev
Browse files

Optimize copy-mem.

parent c69ebc13
...@@ -121,18 +121,18 @@ ...@@ -121,18 +121,18 @@
(declaim (inline copy-mem)) (declaim (inline copy-mem))
(defun copy-mem (from to length) (defun copy-mem (from to length)
(multiple-value-bind (words rest) (truncate length sb-vm:n-word-bytes) (let ((words-end (- length (rem length sb-vm:n-word-bytes))))
(loop repeat words (loop for i by sb-vm:n-word-bytes below words-end
for i by sb-vm:n-word-bytes
do (setf (sb-sys:sap-ref-word to i) do (setf (sb-sys:sap-ref-word to i)
(sb-sys:sap-ref-word from i))) (sb-sys:sap-ref-word from i)))
(loop for i from (- length rest) below length (loop for i from words-end below length
do (setf (sb-sys:sap-ref-8 to i) do (setf (sb-sys:sap-ref-8 to i)
(sb-sys:sap-ref-8 from i))))) (sb-sys:sap-ref-8 from i)))))
(declaim (inline read-ascii-string-optimized)) (declaim (inline read-ascii-string-optimized))
(defun read-ascii-string-optimized (length string stream) (defun read-ascii-string-optimized (length string stream)
(declare (type fixnum length)) (declare (type fixnum length)
(optimize speed))
(sb-sys:with-pinned-objects (string) (sb-sys:with-pinned-objects (string)
(let ((mmap-sap (advance-stream length stream)) (let ((mmap-sap (advance-stream length stream))
(string-sap (sb-sys:vector-sap string))) (string-sap (sb-sys:vector-sap string)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment