Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion base/datafmt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ const offs_chunk_size = 5000
countlines(f::AbstractString, eol::Char='\n') = open(io->countlines(io,eol), f)::Int
function countlines(io::IO, eol::Char='\n')
isascii(eol) || throw(ArgumentError("only ASCII line terminators are supported"))
aeol = UInt8(eol)
a = Array{UInt8}(8192)
nl = 0
while !eof(io)
nb = readbytes!(io, a)
@simd for i=1:nb
@inbounds nl += a[i] == UInt8(eol)
@inbounds nl += a[i] == aeol
end
end
nl
Expand Down