From 30f450d21aad8578d03a66b81ffbdc20515dd5a9 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 24 Nov 2013 20:04:15 -0800 Subject: [PATCH] io.encodings: slight performance improvement to byte-array>string-fast. --- core/io/encodings/encodings.factor | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/io/encodings/encodings.factor b/core/io/encodings/encodings.factor index f4a834380e..6b33357dfb 100644 --- a/core/io/encodings/encodings.factor +++ b/core/io/encodings/encodings.factor @@ -53,13 +53,13 @@ CONSTANT: replacement-char 0xfffd { byte-array } declare [ length ] keep over 0 [ [ + [ [ nth-unsafe ] 2keep drop ] [ - [ - nth-unsafe dup 127 <= - [ drop replacement-char ] unless - ] 2keep drop - ] - [ set-string-nth ] bi* + pick 127 <= + [ set-string-nth-fast ] + [ [ drop replacement-char ] 2dip set-string-nth-slow ] + if + ] bi* ] 2curry each-integer ] keep dup reset-string-hashcode ;