Skip to content

Instantly share code, notes, and snippets.

@kescobo
Created October 2, 2020 16:33
Show Gist options
  • Save kescobo/b248b529e453e207b8bea0d43f6fd25d to your computer and use it in GitHub Desktop.
Save kescobo/b248b529e453e207b8bea0d43f6fd25d to your computer and use it in GitHub Desktop.
DataFrames #2447 benchmarks
using Random, DataFrames, BenchmarkTools
build_any_df(n) = DataFrame(a = [randstring(6) for _ in 1:n], b = rand(n), c = rand(Int, n), d = repeat(["x", "y"], inner=n÷2))
build_num_df(n) = DataFrame(a = [randstring(6) for _ in 1:n], b = rand(n), c = rand(Int, n), d = rand(Bool, n))
build_mixedrow_df(n) = DataFrame(a = [randstring(6) for _ in 1:n], b = rand(n), c = rand(Int, n), d=rand([1., 1, "str"], n))
a10 = build_any_df(10)
a100 = build_any_df(100)
a1k = build_any_df(1_000)
n10 = build_num_df(10)
n100 = build_num_df(100)
n1k = build_num_df(1_000)
mr10 = build_mixedrow_df(10)
mr100 = build_mixedrow_df(100)
mr1k = build_mixedrow_df(1_000)
@warn "a10"
@btime DataFrames.transpose1($a10)
@btime DataFrames.transpose2($a10)
@btime DataFrames.transpose3($a10)
@warn "a100"
@btime DataFrames.transpose1($a100)
@btime DataFrames.transpose2($a100)
@btime DataFrames.transpose3($a100)
@warn "a1k"
@btime DataFrames.transpose1($a1k)
@btime DataFrames.transpose2($a1k)
@btime DataFrames.transpose3($a1k)
@warn "n10"
@btime DataFrames.transpose1($n10)
@btime DataFrames.transpose2($n10)
@btime DataFrames.transpose3($n10)
@warn "n100"
@btime DataFrames.transpose1($n100)
@btime DataFrames.transpose2($n100)
@btime DataFrames.transpose3($n100)
@warn "n1k"
@btime DataFrames.transpose1($n1k)
@btime DataFrames.transpose2($n1k)
@btime DataFrames.transpose3($n1k)
@warn "mr10"
@btime DataFrames.transpose1($mr10)
@btime DataFrames.transpose2($mr10)
@btime DataFrames.transpose3($mr10)
@warn "mr100"
@btime DataFrames.transpose1($mr100)
@btime DataFrames.transpose2($mr100)
@btime DataFrames.transpose3($mr100)
@warn "mr1k"
@btime DataFrames.transpose1($mr1k)
@btime DataFrames.transpose2($mr1k)
@btime DataFrames.transpose3($mr1k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment