Skip to content

Commit

Permalink
Fix performance regression for writing Arrays to files
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Jun 25, 2013
1 parent 53ea785 commit efc2c5e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions base/fs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ function write(f::File, c::Uint8)
write(f,pointer(a),1)
end

function write{T}(f::File, a::Array{T})
if isbits(T)
write(f,pointer(a),length(a)*sizeof(eltype(a)))
else
invoke(write, (IO, Array), f, a)
end
end

function write(f::File, buf::Ptr{Uint8},len::Integer)
if !f.open
error("File is not open")
Expand Down

0 comments on commit efc2c5e

Please sign in to comment.