io.streams.byte-array.fast: push-all is faster for byte-array.
parent
86046dcbf7
commit
d150e5cfe2
|
@ -1,6 +1,7 @@
|
|||
! Copyright (C) 2010 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien byte-vectors io kernel libc math sequences ;
|
||||
USING: alien byte-arrays byte-vectors io kernel libc math
|
||||
sequences ;
|
||||
IN: io.streams.byte-array.fast
|
||||
|
||||
! This is split off from io.streams.byte-array because it uses
|
||||
|
@ -8,6 +9,10 @@ IN: io.streams.byte-array.fast
|
|||
! optimizing compiler has been loaded.
|
||||
|
||||
M: byte-vector stream-write
|
||||
[ dup byte-length tail-slice swap ]
|
||||
[ [ [ byte-length ] bi@ + ] keep lengthen ] 2bi
|
||||
dup byte-length memcpy ;
|
||||
over byte-array? [
|
||||
push-all ! faster than memcpy
|
||||
] [
|
||||
2dup [ byte-length ] bi@
|
||||
3dup + swap lengthen
|
||||
[ tail-slice swap ] curry dip memcpy
|
||||
] if ;
|
||||
|
|
Loading…
Reference in New Issue