Skip to content

Commit

Permalink
seems read(., Char) is faster
Browse files Browse the repository at this point in the history
  • Loading branch information
iblislin committed Feb 2, 2018
1 parent 68797a2 commit 6a15408
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/lib/block-io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ 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

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

Expand Down

0 comments on commit 6a15408

Please sign in to comment.