Skip to content

Commit

Permalink
Speed up writing strings a bit
Browse files Browse the repository at this point in the history
Avoid boxing due to pointer instability. This branch is now beating
Base.serialize by >2x on the test case from
JuliaData/DataFrames.jl#667
  • Loading branch information
simonster committed Aug 14, 2014
1 parent c41caa9 commit 162fe65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ function h5d_write{S<:ByteString}(dataset_id::Hid, memtype_id::Hid, strs::Array{
len = length(strs)
p = Array(Ptr{Uint8}, size(strs))
for i = 1:len
p[i] = convert(Ptr{Uint8}, !isdefined(strs, i) || isempty(strs[i]) ? EMPTY_STRING : strs[i])
p[i] = !isdefined(strs, i) || isempty(strs[i]) ? pointer(EMPTY_STRING) : pointer(strs[i])
end
h5d_write(dataset_id, memtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, p)
end
Expand Down

0 comments on commit 162fe65

Please sign in to comment.