From 6a15408390b9300fe894c5970d4395e19ba387c1 Mon Sep 17 00:00:00 2001 From: Iblis Lin Date: Fri, 2 Feb 2018 20:46:44 +0800 Subject: [PATCH] seems read(., Char) is faster --- src/lib/block-io.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/block-io.jl b/src/lib/block-io.jl index c8b0d0074..c498b1d4a 100644 --- a/src/lib/block-io.jl +++ b/src/lib/block-io.jl @@ -11,9 +11,8 @@ struct BlockIO <: IO function find_end_pos(bio::BlockIO, end_byte::Char) seekend(bio) - end_byte = UInt8(end_byte) try - while(!eof(bio.s) && (end_byte != read(bio, UInt8))) continue end + while(!eof(bio.s) && (end_byte != read(bio, Char))) continue end end position(bio.s) end @@ -21,8 +20,7 @@ struct BlockIO <: IO function find_start_pos(bio::BlockIO, end_byte::Char) (bio.r.start == 1) && (return bio.r.start) seekstart(bio) - end_byte = UInt8(end_byte) - !eof(bio.s) && while(end_byte != read(bio, UInt8)) continue end + !eof(bio.s) && while(end_byte != read(bio, Char)) continue end position(bio.s)+1 end