Making use of precompile


I have a very simple program using ArgParse.jl:

using ArgParse

function main(args)
    s = ArgParseSettings(description = "Example 1 for argparse.jl: minimal usage.")

    @add_arg_table s begin
        "--max_n", "-N"               # an option (will take an argument)

    parsed_args = parse_args(s) # the result is a Dict{String,Any}
    N = parse(Int64, parsed_args["max_n"])
    println("N = ", N)


and if i run it, it is quite slow.

time ./julia test.jl -N=1                                                                        
N = 1
./julia test.jl -N=1  6.33s user 0.38s system 105% cpu 6.338 total

This seems to be and old issue for julia and I know there are a lot of posts about this. The fix seems to be to include precompile() in your module, which ArgParse does. How can I load modules faster in Julia?


There is not proper solution to this yet. and Prerelease: MakiE - interactive plotting! has also some relevant discussions.