Skip to content

Commit

Permalink
Manually hoist conversion of end-of-line character to UInt8 (#16886)
Browse files Browse the repository at this point in the history
In some confiurations LLVM doesn't seem to do this optimization

Fix #16822
  • Loading branch information
StefanKarpinski authored Jun 13, 2016
1 parent a84f702 commit 2119ea6
Showing 1 changed file with 2 additions and 1 deletion.
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

2 comments on commit 2119ea6

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.