|
1 | | -# precompile.jl contains precompilation directives for all methods whose compilation |
2 | | -# is triggered by running DataFrames tests and takes more than a given threshold |
3 | | -# of 0.1. |
4 | | -# `precompile` calls are generated using SnoopCompile via: |
5 | | -# using SnoopCompileCore |
6 | | -# inf_timing = @snoopi tmin=0.1 include("test/runtests.jl") |
7 | | -# using SnoopCompile |
8 | | -# pc = SnoopCompile.parcel(inf_timing) |
9 | | -# SnoopCompile.write("src/other/precompile_tmp.jl", pc[:DataFrames], always=true) |
10 | | -# and then hand edited. The editing steps are: |
11 | | -# * removing signatures with anonymous functions |
12 | | -# * removing signatures with specific NamedTuples passed as arguments except `x1` as name or kwargs |
13 | | -# (which is generated internally) |
14 | | -# * changing Int64 to Int (to handle 32-bit architectures correctly) |
15 | | -# * disabling precompilation on Julia older than 1.5 |
16 | | -# * run @warnpcfail check for all=true and all=false both on Julia stable and nightly |
| 1 | +import SnoopPrecompile |
17 | 2 |
|
18 | | -function precompile(all=false) |
19 | | - all || ccall(:jl_generating_output, Cint, ()) == 1 || return nothing |
20 | | - |
21 | | - Base.precompile(Tuple{Aggregate{typeof(std), Nothing},Vector{Union{Missing, Int}},GroupedDataFrame{DataFrame}}) |
22 | | - Base.precompile(Tuple{Core.kwftype(typeof(describe)),NamedTuple{(:cols,), Tuple{Vector{Pair{Symbol, Pair{Function, Symbol}}}}},typeof(describe),DataFrame}) |
23 | | - Base.precompile(Tuple{Core.kwftype(typeof(innerjoin)),NamedTuple{(:on, :makeunique, :validate, :renamecols), Tuple{Symbol, Bool, Pair{Bool, Bool}, Pair{String, String}}},typeof(innerjoin),DataFrame,DataFrame}) |
24 | | - Base.precompile(Tuple{Core.kwftype(typeof(innerjoin)),NamedTuple{(:on, :makeunique, :validate, :renamecols), Tuple{Symbol, Bool, Pair{Bool, Bool}, Pair{String, Symbol}}},typeof(innerjoin),DataFrame,DataFrame}) |
25 | | - Base.precompile(Tuple{Core.kwftype(typeof(innerjoin)),NamedTuple{(:on, :makeunique, :validate, :renamecols), Tuple{Symbol, Bool, Pair{Bool, Bool}, Pair{Symbol, Symbol}}},typeof(innerjoin),DataFrame,DataFrame}) |
26 | | - Base.precompile(Tuple{Core.kwftype(typeof(innerjoin)),NamedTuple{(:on, :makeunique, :validate, :renamecols), Tuple{Vector{Any}, Bool, Pair{Bool, Bool}, Pair{String, Symbol}}},typeof(innerjoin),DataFrame,DataFrame}) |
27 | | - Base.precompile(Tuple{Core.kwftype(typeof(innerjoin)),NamedTuple{(:on, :renamecols), Tuple{Vector{Any}, Pair{String, String}}},typeof(innerjoin),DataFrame,DataFrame}) |
28 | | - Base.precompile(Tuple{Core.kwftype(typeof(innerjoin)),NamedTuple{(:on,), Tuple{Symbol}},typeof(innerjoin),DataFrame,DataFrame}) |
29 | | - Base.precompile(Tuple{Core.kwftype(typeof(leftjoin!)),NamedTuple{(:on, :makeunique, :source), Tuple{Pair{Symbol, Symbol}, Bool, Symbol}},typeof(leftjoin!),DataFrame,DataFrame}) |
30 | | - Base.precompile(Tuple{Core.kwftype(typeof(leftjoin)),NamedTuple{(:on, :makeunique, :validate, :renamecols), Tuple{Vector{Any}, Bool, Pair{Bool, Bool}, Pair{Symbol, String}}},typeof(leftjoin),DataFrame,DataFrame}) |
31 | | - Base.precompile(Tuple{Core.kwftype(typeof(leftjoin)),NamedTuple{(:on, :renamecols, :source), Tuple{Vector{Any}, Pair{String, String}, Symbol}},typeof(leftjoin),DataFrame,DataFrame}) |
32 | | - Base.precompile(Tuple{Core.kwftype(typeof(outerjoin)),NamedTuple{(:on, :makeunique, :validate, :renamecols), Tuple{Vector{Any}, Bool, Pair{Bool, Bool}, Pair{Symbol, Symbol}}},typeof(outerjoin),DataFrame,DataFrame}) |
33 | | - Base.precompile(Tuple{Core.kwftype(typeof(outerjoin)),NamedTuple{(:on, :source, :makeunique), Tuple{Symbol, String, Bool}},typeof(outerjoin),DataFrame,DataFrame}) |
34 | | - Base.precompile(Tuple{Core.kwftype(typeof(outerjoin)),NamedTuple{(:on, :source, :makeunique), Tuple{Symbol, Symbol, Bool}},typeof(outerjoin),DataFrame,DataFrame}) |
35 | | - Base.precompile(Tuple{Core.kwftype(typeof(reduce)),NamedTuple{(:cols, :source), Tuple{Symbol, Nothing}},typeof(reduce),typeof(vcat),NTuple{5, DataFrame}}) |
36 | | - Base.precompile(Tuple{Core.kwftype(typeof(select!)),NamedTuple{(:renamecols,), Tuple{Bool}},typeof(select!),GroupedDataFrame{SubDataFrame{DataFrame, SubIndex{Index, Vector{Int}, Vector{Int}}, UnitRange{Int}}},Union{Regex, AbstractString, Function, Signed, Symbol, Unsigned, Pair, Type, All, Between, Cols, InvertedIndex, AbstractVecOrMat{T} where T}}) |
37 | | - Base.precompile(Tuple{Core.kwftype(typeof(show)),NamedTuple{(:allrows, :allcols, :allgroups, :rowlabel, :summary, :truncate), Tuple{Bool, Bool, Bool, Symbol, Bool, Int}},typeof(show),Base.PipeEndpoint,GroupedDataFrame{DataFrame}}) |
38 | | - Base.precompile(Tuple{Core.kwftype(typeof(show)),NamedTuple{(:show_row_number,), Tuple{Bool}},typeof(show),IOContext{IOBuffer},DataFrame}) |
39 | | - Base.precompile(Tuple{Core.kwftype(typeof(vcat)),NamedTuple{(:cols, :source), Tuple{Symbol, Symbol}},typeof(vcat),DataFrame,Vararg{DataFrame}}) |
40 | | - Base.precompile(Tuple{Core.kwftype(typeof(vcat)),NamedTuple{(:cols,), Tuple{Vector{Symbol}}},typeof(vcat),DataFrame,Vararg{DataFrame}}) |
41 | | - Base.precompile(Tuple{Type{DataFrame},Vector{Tuple{Int, Int}}}) |
42 | | - Base.precompile(Tuple{typeof(_innerjoin_sorted),OnCol{Tuple{Vector{Int}, Vector{String}}, 2},OnCol{Tuple{SubArray{Union{Missing, Int}, 1, Vector{Union{Missing, Int}}, Tuple{Vector{Int}}, false}, SubArray{Union{Missing, String}, 1, Vector{Union{Missing, String}}, Tuple{Vector{Int}}, false}}, 2}}) |
43 | | - Base.precompile(Tuple{typeof(_innerjoin_sorted),OnCol{Tuple{Vector{UInt32}, Vector{UInt32}, Vector{UInt32}}, 3},OnCol{Tuple{Vector{UInt32}, Vector{UInt32}, Vector{UInt32}}, 3}}) |
44 | | - Base.precompile(Tuple{typeof(_innerjoin_unsorted_int),SubArray{Union{Missing, Int}, 1, Vector{Union{Missing, Int}}, Tuple{Vector{Int}}, false},Vector{Missing}}) |
45 | | - Base.precompile(Tuple{typeof(_innerjoin_unsorted_int),Vector{Int32},Vector{Int32}}) |
46 | | - Base.precompile(Tuple{typeof(_innerjoin_unsorted),OnCol{Tuple{Vector{Union{Missing, String}}, Vector{Union{Missing, String}}, Vector{Union{Missing, String}}}, 3},OnCol{Tuple{Vector{String}, Vector{String}, Vector{String}}, 3}}) |
47 | | - Base.precompile(Tuple{typeof(_innerjoin_unsorted),OnCol{Tuple{Vector{Union{Missing, Symbol}}, Vector{Union{Missing, Symbol}}}, 2},OnCol{Tuple{Vector{Union{Missing, Symbol}}, Vector{Union{Missing, Symbol}}}, 2}}) |
48 | | - Base.precompile(Tuple{typeof(_mean_fast),Vector{Vector{Union{Missing, Int}}}}) |
49 | | - Base.precompile(Tuple{typeof(_semijoin_unsorted_int),Vector{Int},Vector{Union{Missing, Int}},BitVector,Bool}) |
50 | | - Base.precompile(Tuple{typeof(_semijoin_unsorted),OnCol{Tuple{Vector{UInt32}, Vector{UInt32}}, 2},OnCol{Tuple{Vector{Union{Missing, UInt32}}, Vector{Union{Missing, UInt32}}}, 2},BitVector,Bool}) |
51 | | - Base.precompile(Tuple{typeof(Base.Broadcast.dotview),SubDataFrame{DataFrame, Index, Vector{Int}},Colon,Symbol}) |
52 | | - Base.precompile(Tuple{typeof(describe),DataFrame}) |
53 | | - Base.precompile(Tuple{typeof(do_call),ComposedFunction{typeof(sum), typeof(skipmissing)},Vector{Int},Vector{Int},Vector{Int},GroupedDataFrame{DataFrame},Tuple{Vector{Union{Missing, String}}},Int}) |
54 | | - Base.precompile(Tuple{typeof(do_call),typeof(cor),Vector{Int},Vector{Int},Vector{Int},GroupedDataFrame{DataFrame},Tuple{Vector{Int}, Vector{Int}},Int}) |
55 | | - Base.precompile(Tuple{typeof(do_call),typeof(sum),Vector{Int},Vector{Int},Vector{Int},GroupedDataFrame{DataFrame},Tuple{Vector{DataFrame}},Int}) |
56 | | - Base.precompile(Tuple{typeof(groupby),DataFrame,Symbol}) |
57 | | - Base.precompile(Tuple{typeof(names),DataFrameRow{DataFrame, SubIndex{Index, Vector{Int}, Vector{Int}}},Cols{Tuple{String}}}) |
58 | | - Base.precompile(Tuple{typeof(permutedims),DataFrame,Symbol}) |
59 | | - Base.precompile(Tuple{typeof(prepare_on_col),Vector{Int},Vector{Union{}}}) |
60 | | - Base.precompile(Tuple{typeof(repeat),DataFrame,Int}) |
61 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{BitVector},Val{false},Vector{Int},Bool,Nothing}) |
62 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{PooledVector{Int, UInt32, Vector{UInt32}}, PooledVector{String, UInt32, Vector{UInt32}}},Val{false},Vector{Int},Bool,Nothing}) |
63 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{PooledVector{String, UInt32, Vector{UInt32}}, Vector{Int}},Val{false},Vector{Int},Bool,Nothing}) |
64 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{PooledVector{String, UInt32, Vector{UInt32}}, Vector{Int32}},Val{false},Vector{Int},Bool,Nothing}) |
65 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{PooledVector{Union{Missing, Int}, UInt32, Vector{UInt32}}, PooledVector{String, UInt32, Vector{UInt32}}},Val{false},Vector{Int},Bool,Nothing}) |
66 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{PooledVector{Union{Missing, String}, UInt32, Vector{UInt32}}, PooledVector{String, UInt32, Vector{UInt32}}},Val{false},Vector{Int},Bool,Nothing}) |
67 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{RepeatedVector{Union{Missing, Int}}, RepeatedVector{Union{Missing, Int}}, RepeatedVector{Union{Missing, String}}, Vector{Union{Missing, Int}}},Val{false},Vector{Int},Bool,Nothing}) |
68 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{SubArray{Int, 1, Vector{Int}, Tuple{Base.OneTo{Int}}, true}},Tuple{IntegerRefpool{Int}},Tuple{IntegerRefarray{SubArray{Int, 1, Vector{Int}, Tuple{Base.OneTo{Int}}, true}}},Val{false},Vector{Int},Bool,Bool}) |
69 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{SubArray{Union{Missing, Int}, 1, Vector{Union{Missing, Int}}, Tuple{Base.OneTo{Int}}, true}},Tuple{IntegerRefpool{Union{Missing, Int}}},Tuple{IntegerRefarray{SubArray{Union{Missing, Int}, 1, Vector{Union{Missing, Int}}, Tuple{Base.OneTo{Int}}, true}}},Val{false},Vector{Int},Bool,Bool}) |
70 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Bool}},Val{false},Vector{Int},Bool,Nothing}) |
71 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Float64}, Vector{Int}},Val{false},Vector{Int},Bool,Nothing}) |
72 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Int}, Vector{Int}, Vector{Int}},Val{false},Vector{Int},Bool,Nothing}) |
73 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Int}, Vector{Union{Missing, Int}}},Val{false},Vector{Int},Bool,Nothing}) |
74 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Int32}, Vector{Int32}},Val{false},Vector{Int},Bool,Nothing}) |
75 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Int32}},Tuple{IntegerRefpool{Int}},Tuple{IntegerRefarray{Vector{Int32}}},Val{false},Vector{Int},Bool,Bool}) |
76 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Int32}},Val{false},Vector{Int},Bool,Nothing}) |
77 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{String}, Vector{Int32}},Val{false},Vector{Int},Bool,Nothing}) |
78 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Union{Missing, BigInt}}},Val{false},Vector{Int},Bool,Nothing}) |
79 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Union{Missing, Bool}}},Tuple{IntegerRefpool{Union{Missing, Int}}},Tuple{IntegerRefarray{Vector{Union{Missing, Bool}}}},Val{false},Vector{Int},Bool,Bool}) |
80 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Union{Missing, Bool}}},Val{false},Vector{Int},Bool,Nothing}) |
81 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Union{Missing, Float64}}, Vector{Float64}},Val{false},Vector{Int},Bool,Nothing}) |
82 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Union{Missing, Float64}}, Vector{Int}},Val{false},Vector{Int},Bool,Nothing}) |
83 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Union{Missing, Int}}, Vector{Union{Missing, Float64}}},Tuple{IntegerRefpool{Union{Missing, Int}}, IntegerRefpool{Union{Missing, Int}}},Tuple{IntegerRefarray{Vector{Union{Missing, Int}}}, IntegerRefarray{Vector{Union{Missing, Float64}}}},Val{false},Vector{Int},Bool,Bool}) |
84 | | - Base.precompile(Tuple{typeof(row_group_slots),Tuple{Vector{Union{Missing, Int}}},Val{false},Vector{Int},Bool,Nothing}) |
85 | | - Base.precompile(Tuple{typeof(select),SubDataFrame{DataFrame, Index, UnitRange{Int}},Any}) |
86 | | - Base.precompile(Tuple{typeof(select),SubDataFrame{DataFrame, SubIndex{Index, UnitRange{Int}, UnitRange{Int}}, Vector{Int}},Any,Any,Vararg{Any}}) |
87 | | - Base.precompile(Tuple{typeof(setindex!),DataFrame,Vector{Int},Vector{Bool},Int}) |
88 | | - Base.precompile(Tuple{typeof(show),IOBuffer,DataFrameRow{DataFrame, SubIndex{Index, UnitRange{Int}, UnitRange{Int}}}}) |
89 | | - Base.precompile(Tuple{typeof(sort),SubDataFrame{DataFrame, SubIndex{Index, UnitRange{Int}, UnitRange{Int}}, UnitRange{Int}}}) |
90 | | - Base.precompile(Tuple{typeof(subset),GroupedDataFrame{SubDataFrame{DataFrame, Index, UnitRange{Int}}},Any}) |
91 | | - Base.precompile(Tuple{typeof(transform),GroupedDataFrame{DataFrame},Union{Regex, AbstractString, Function, Signed, Symbol, Unsigned, Pair, Type, All, Between, Cols, InvertedIndex, AbstractVecOrMat{T} where T}}) |
92 | | - Base.precompile(Tuple{typeof(view),SubDataFrame{DataFrame, Index, UnitRange{Int}},Int,Int}) |
93 | | - |
94 | | - if all |
95 | | - for v in ([1, 2], [2, 1], [2, 2, 1], Int32[1, 2], Int32[2, 1], Int32[2, 2, 1]), |
96 | | - op in (identity, x -> string.(x), x -> PooledArrays.PooledArray(string.(x))), |
97 | | - on in (:v1, [:v1, :v2]) |
98 | | - df = DataFrame(v1=op(v), v2=v) |
99 | | - combine(groupby(df, on), identity, :v1 => identity, |
100 | | - :v2 => ByRow(identity), :v2 => sum) |
101 | | - innerjoin(df, select(df, on), on=on) |
102 | | - outerjoin(df, select(df, on), on=on) |
103 | | - end |
104 | | - end |
105 | | - return nothing |
| 3 | +SnoopPrecompile.@precompile_all_calls begin |
| 4 | + df = DataFrame(a=[2, 5, 3, 1, 0], b=["a", "b", "c", "a", "b"], c=1:5, |
| 5 | + p=PooledArray(["a", "b", "c", "a", "b"]), |
| 6 | + q=[true, false, true, false, true], |
| 7 | + f=Float64[2, 5, 3, 1, 0]) |
| 8 | + describe(df) |
| 9 | + names(df[1, 1:2]) |
| 10 | + sort(df, :a) |
| 11 | + combine(df, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor) |
| 12 | + transform(df, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor) |
| 13 | + groupby(df, :a) |
| 14 | + groupby(df, :q) |
| 15 | + groupby(df, :p) |
| 16 | + gdf = groupby(df, :b) |
| 17 | + combine(gdf, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor) |
| 18 | + transform(gdf, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor) |
| 19 | + innerjoin(df, df, on=:a, makeunique=true) |
| 20 | + innerjoin(df, df, on=:b, makeunique=true) |
| 21 | + innerjoin(df, df, on=:c, makeunique=true) |
| 22 | + outerjoin(df, df, on=:a, makeunique=true) |
| 23 | + outerjoin(df, df, on=:b, makeunique=true) |
| 24 | + outerjoin(df, df, on=:c, makeunique=true) |
| 25 | + semijoin(df, df, on=:a) |
| 26 | + semijoin(df, df, on=:b) |
| 27 | + semijoin(df, df, on=:c) |
| 28 | + leftjoin!(df, DataFrame(a=[2, 5, 3, 1, 0]), on=:a) |
| 29 | + leftjoin!(df, DataFrame(b=["a", "b", "c", "d", "e"]), on=:b) |
| 30 | + leftjoin!(df, DataFrame(c=1:5), on=:c) |
| 31 | + reduce(vcat, [df, df]) |
| 32 | + show(IOBuffer(), df) |
| 33 | + subset(df, :q) |
| 34 | + @view df[1:3, :] |
| 35 | + @view df[:, 1:2] |
| 36 | + transform!(df, :c, [:c :f] .=> [sum, mean, std], :c => :d, [:a, :c] => cor) |
106 | 37 | end |
0 commit comments