]> gitweb.factorcode.org Git - factor.git/commitdiff
splitting: faster split-lines using subseq-unsafe
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 26 Oct 2023 00:44:40 +0000 (17:44 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 26 Oct 2023 00:44:40 +0000 (17:44 -0700)
core/splitting/splitting.factor

index 8bcb00cfe7a218dcabb97a51522910195e21da1d..41167bbbbf5c5cb5d5833d0fcffcdcecef008a9e 100644 (file)
@@ -120,7 +120,7 @@ M:: string split-lines ( seq -- seq' )
     seq length :> len
     V{ } clone 0 [ dup len < ] [
         dup seq [ linebreak? ] find-from [
-            len or [ seq subseq suffix! ] [ 1 + ] bi
+            len or [ seq subseq-unsafe suffix! ] [ 1 + ] bi
         ] [
             CHAR: \r eq? [
                dup seq ?nth CHAR: \n eq? [ 1 + ] when