Skip to content

Commit

Permalink
updated benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
benhamner committed Nov 23, 2014
1 parent 003075e commit 96c8208
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion benchmark/readxsv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ xsv_string, xsv_data = genxsv(num_rows=5, num_cols=2)
xsv_string_h = join(["C"*string(i) for i=1:length(xsv_data[1])], ",") * "\n" * xsv_string
xsv = readxsv(xsv_string)
for row in iterxsv(xsv_string) end
for row in iterxsvh(xsv_string) end
for row in iterxsvh(xsv_string_h) end
for row in iterxsvht(xsv_string_h, row_type_name="XsvTestRow") end

xsv_string, xsv_data = genxsv(num_rows=20_000, num_cols=20)
println("readxsv:")
Expand All @@ -16,3 +17,6 @@ println("\niterxsv:")
xsv_string_h = join(["C"*string(i) for i=1:length(xsv_data[1])], ",") * "\n" * xsv_string
println("\niterxsvh:")
@time for row in iterxsvh(xsv_string_h) end

println("\niterxsvht:")
@time for row in iterxsvht(xsv_string_h) end
6 changes: 3 additions & 3 deletions src/readxsv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ function _iterxsvh(io::IO; delimiter=','::Char, quotechar='"'::Char, strtype="as
end
end
iterxsvh(data::String; delimiter=','::Char, quotechar='"'::Char, strtype="ascii"::String) = @task _iterxsvh(IOBuffer(data), delimiter=delimiter, quotechar=quotechar, strtype=strtype)
function _iterxsvht(io::IO; delimiter=','::Char, quotechar='"'::Char, strtype="ascii"::String, close_io=false::Bool)
function _iterxsvht(io::IO; delimiter=','::Char, quotechar='"'::Char, strtype="ascii"::String, close_io=false::Bool, row_type_name=""::ASCIIString)
xsv_stream = iterxsv(io, delimiter=delimiter, quotechar=quotechar, strtype=strtype, close_io=close_io)
header = consume(xsv_stream)
xsv_row = create_xsv_row_type(header, strtype=strtype)
xsv_row = create_xsv_row_type(header, strtype=strtype, type_name=row_type_name)
for row in xsv_stream
produce(xsv_row(row...))
end
end
iterxsvht(data::String; delimiter=','::Char, quotechar='"'::Char, strtype="ascii"::String) = @task _iterxsvht(IOBuffer(data), delimiter=delimiter, quotechar=quotechar, strtype=strtype)
iterxsvht(data::String; delimiter=','::Char, quotechar='"'::Char, strtype="ascii"::String, row_type_name=""::ASCIIString) = @task _iterxsvht(IOBuffer(data), delimiter=delimiter, quotechar=quotechar, strtype=strtype, row_type_name=row_type_name)

function readxsv(io::IO; delimiter=','::Char, quotechar='"'::Char, strtype="ascii"::String, close_io=false::Bool)
string_type = get_string_type(strtype)
Expand Down

0 comments on commit 96c8208

Please sign in to comment.