io.encodings: stream-contents method for decoder
stream-contents on decoder is much faster implemented using a read1 loop than with the default implementation.
parent
372f7c6614
commit
440130d618
|
|
@ -91,7 +91,7 @@ M: decoder stream-read1 ( decoder -- ch )
|
|||
] [ (finish-read) ] if*
|
||||
] if ; inline recursive
|
||||
|
||||
M: decoder stream-read-unsafe ( n buf decoder -- count )
|
||||
M: decoder stream-read-unsafe
|
||||
pick 0 = [ 3drop 0 ] [
|
||||
(read-first) [
|
||||
0 (store-read)
|
||||
|
|
@ -99,6 +99,9 @@ M: decoder stream-read-unsafe ( n buf decoder -- count )
|
|||
] [ 2drop 2drop 0 ] if*
|
||||
] if ; inline
|
||||
|
||||
M: decoder stream-contents
|
||||
(stream-contents-by-element) ;
|
||||
|
||||
: line-ends/eof ( stream str -- str ) f like swap cr- ; inline
|
||||
|
||||
: line-ends\r ( stream str -- str ) swap cr+ ; inline
|
||||
|
|
|
|||
Loading…
Reference in New Issue