Skip to content

Commit

Permalink
Add unexported precompile() function to facilitate benchmarking
Browse files Browse the repository at this point in the history
`DataFrames.precompile()` precompiles all methods that are used when running tests.
This is useful to run benchmarks like H2Oai where the time of the first run should
include the time needed to specialize on a particular operation on a particular
dataset, but not the time needed for the more general compilation of common parts.
It could also be useful for users who would like to generate a precompiled image.

To avoid making the package slower to precompile or load, the precompilation code
is only included when actually used.
  • Loading branch information
nalimilan committed Sep 27, 2020
1 parent 8ea2edf commit 41ce3ed
Show file tree
Hide file tree
Showing 2 changed files with 4,000 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/other/utils.jl
Expand Up @@ -88,3 +88,14 @@ else
end

funname(c::ComposedFunction) = Symbol(funname(c.f), :_, funname(c.g))

# precompile.jl contains precompilation directives for all methods whose compilation
# is triggered by running DataFrames tests and takes more than 0.01s.
# It is generated using the SnoopCompile package via:
# inf_timing = @snoopi tmin=0.01 include("test/runtests.jl")
# pc = SnoopCompile.parcel(inf_timing)
# SnoopCompile.write("src/precompile", pc[:DataFrames], always=true)
function precompile()
include(joinpath(dirname(pathof(DataFrames)), "precompile.jl"))
return nothing
end

0 comments on commit 41ce3ed

Please sign in to comment.