Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vladimir Sedach
storage
Commits
f2a504a1
Commit
f2a504a1
authored
Mar 23, 2012
by
Stas Boukarev
Browse files
Slightly optimize copy-mem by aligning the buffer.
parent
7234a088
Changes
1
Hide whitespace changes
Inline
Side-by-side
io-sbcl.lisp
View file @
f2a504a1
...
@@ -8,12 +8,14 @@
...
@@ -8,12 +8,14 @@
(
defconstant
+buffer-size+
8192
)
(
defconstant
+buffer-size+
8192
)
(
deftype
word
()
'sb-vm:word
)
(
deftype
word
()
'sb-vm:word
)
(
deftype
signed-word
()
'sb-vm:signed-word
)
(
defun
allocate-buffer
()
(
defun
allocate-buffer
()
(
sb-sys:sap-int
(
sb-sys:sap-int
(
sb-alien:alien-sap
(
sb-alien:alien-sap
(
sb-alien:make-alien
char
(
+
+buffer-size+
3
)))))
(
sb-alien:make-alien
char
;; alignment
(
+
+buffer-size+
(
1-
sb-vm:n-word-bytes
))))))
(
defstruct
(
input-stream
(
defstruct
(
input-stream
(
:predicate
nil
))
(
:predicate
nil
))
...
@@ -215,15 +217,9 @@
...
@@ -215,15 +217,9 @@
(
declaim
(
inline
copy-mem
))
(
declaim
(
inline
copy-mem
))
(
defun
copy-mem
(
from
to
length
)
(
defun
copy-mem
(
from
to
length
)
(
declare
(
word
length
))
(
declare
(
word
length
))
(
let
((
words-end
(
sb-ext:truly-the
word
(
loop
for
i
fixnum
by
sb-vm:n-word-bytes
to
length
(
-
length
do
(
setf
(
sb-sys:sap-ref-word
to
i
)
(
rem
length
sb-vm:n-word-bytes
)))))
(
sb-sys:sap-ref-word
from
i
))))
(
loop
for
i
fixnum
by
sb-vm:n-word-bytes
below
words-end
do
(
setf
(
sb-sys:sap-ref-word
to
i
)
(
sb-sys:sap-ref-word
from
i
)))
(
loop
for
i
fixnum
from
words-end
below
length
do
(
setf
(
sb-sys:sap-ref-8
to
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment