From d150e5cfe27e738d86f437e620f645f5ec046df7 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 19 May 2019 18:47:34 -0700 Subject: [PATCH] io.streams.byte-array.fast: push-all is faster for byte-array. --- basis/io/streams/byte-array/fast/fast.factor | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/basis/io/streams/byte-array/fast/fast.factor b/basis/io/streams/byte-array/fast/fast.factor index 2948e2bc61..9f74d0778b 100644 --- a/basis/io/streams/byte-array/fast/fast.factor +++ b/basis/io/streams/byte-array/fast/fast.factor @@ -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 ;