Skip to content

Instantly share code, notes, and snippets.

@waTeim
Created March 19, 2016 03:14
Show Gist options
  • Select an option

  • Save waTeim/bfccf44d96016a51dd75 to your computer and use it in GitHub Desktop.

Select an option

Save waTeim/bfccf44d96016a51dd75 to your computer and use it in GitHub Desktop.
Julia package precompile steps to aid in startup speed on ARM
function _precompile_()
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
precompile(Base.Serializer.serialize_type, (Base.SerializationState{Base.Pipe}, DataType,))
precompile(Base.Serializer.write_as_tag, (Base.Pipe, Int32,))
precompile(Base.check_open, (Base.PipeEndpoint,))
precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, UInt8,))
precompile(Base.write, (Base.Pipe, Array{UInt8, 1},))
precompile(Base.flush, (Base.PipeEndpoint,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Int32,))
precompile(Base.Filesystem.lstat, (ASCIIString,))
precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, LineNumberNode,))
precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, Array{UInt8, 1},))
precompile(Base.Serializer.serialize_array_data, (Base.Pipe, Array{UInt8, 1},))
precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, QuoteNode,))
precompile(Base.Serializer.serialize_any, (Base.SerializationState{Base.Pipe}, UInt8,))
precompile(Base.close, (Base.Pipe,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Tuple{Int32},))
precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, Expr,))
precompile(Base.Serializer.serialize_any, (Base.SerializationState{Base.Pipe}, LineNumberNode,))
precompile(Base.unsafe_write, (Base.Pipe, Base.RefValue{Int32}, Int32,))
precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, Array{Union{UTF8String, ASCIIString}, 1},))
precompile(Base.write, (Base.Pipe, Array{Union{UTF8String, ASCIIString}, 1},))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Symbol,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, SimpleVector,))
precompile(Base.uv_write, (Base.PipeEndpoint, Ptr{UInt8}, UInt32,))
precompile(Base.cmd_gen, (Tuple{Tuple{UTF8String}, Tuple{ASCIIString, ASCIIString}, Tuple{ASCIIString, ASCIIString}},))
precompile(Base.Serializer.serialize_mod_names, (Base.SerializationState{Base.Pipe}, Module,))
precompile(Base._uv_hook_close, (Base.Process,))
precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, ASCIIString,))
precompile(Base.call, (Type{Base.Process}, Base.Cmd, Ptr{Void}, Base.Pipe, Base.TTY, Base.TTY,))
precompile(Base.call, (Type{Base.RefArray{Union{UTF8String, ASCIIString}, Array{Union{UTF8String, ASCIIString}, 1}, Any}}, Array{Union{UTF8String, ASCIIString}, 1}, Int32, Bool,))
precompile(Base.indexed_next, (Tuple{Base.Pipe, Base.Process}, Int32, Int32,))
precompile(Base.malloc_julia_pipe!, (Base.PipeEndpoint,))
precompile(Base.open, (Base.CmdRedirect, ASCIIString, Base.TTY,))
precompile(Base.create_expr_cache, (ASCIIString, ASCIIString,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, QuoteNode,))
precompile(Base.convert, (Type{Base.IO}, Base.TTY,))
precompile(Base.call, (Array{Any, 1}, Type{Base.Cmd}, Base.Cmd,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Array{UInt8, 1},))
precompile(Base.uvfinalize, (Base.Process,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Bool,))
precompile(Base.cmd_gen, (Tuple{Tuple{Base.Cmd}, Tuple{ASCIIString}, Tuple{ASCIIString}, Tuple{ASCIIString}, Tuple{ASCIIString}, Tuple{ASCIIString}, Tuple{ASCIIString, ASCIIString}, Tuple{ASCIIString}, Tuple{ASCIIString}},))
precompile(Base.with_output_color, (Function, Symbol, Base.TTY, ASCIIString,))
precompile(Base.unsafe_convert, (Type{Ptr{Ptr{UInt8}}}, Base.RefArray{Ptr{UInt8}, Array{Ptr{UInt8}, 1}, Any},))
precompile(Base.call, (Type{Base.RefArray{Ptr{UInt8}, Array{Ptr{UInt8}, 1}, Any}}, Array{Ptr{UInt8}, 1}, Int32, Array{Any, 1},))
precompile(Base.arg_gen, (ASCIIString, ASCIIString,))
precompile(Base.Filesystem.unlink, (ASCIIString,))
precompile(Base.pipeline, (Array{Any, 1}, Base.Cmd,))
precompile(Base.getindex, (Type{Union{UTF8String, ASCIIString}}, UTF8String,))
precompile(Base.compilecache, (ASCIIString,))
precompile(Base._jl_spawn, (UTF8String, Array{Union{UTF8String, ASCIIString}, 1}, Ptr{Void}, Base.Process, Base.PipeEndpoint, Base.TTY, Base.TTY,))
precompile(Base._link_pipe, (Ptr{Void}, Ptr{Void},))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Expr,))
precompile(Base.info, (Array{Any, 1}, Base.TTY, ASCIIString,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Array{Union{UTF8String, ASCIIString}, 1},))
precompile(Base.containsnul, (UTF8String,))
precompile(Base.repl_color, (ASCIIString, Symbol,))
precompile(Base.Serializer.serialize_any, (Base.SerializationState{Base.Pipe}, QuoteNode,))
precompile(Base.julia_cmd, (UTF8String,))
precompile(Base.spawn, (Array{Any, 1}, Base.CmdRedirect, Tuple{Base.Pipe, Base.TTY, Base.TTY}, Bool, Bool,))
precompile(Base.uvfinalize, (Base.PipeEndpoint,))
precompile(Base.append!, (Array{Union{UTF8String, ASCIIString}, 1}, Array{Union{UTF8String, ASCIIString}, 1},))
precompile(Base.setup_stdio, (Function, Tuple{Base.Pipe, Base.TTY, Base.TTY},))
precompile(Base.julia_cmd, ())
precompile(Base.println_with_color, (Symbol, Base.TTY, ASCIIString,))
precompile(Base.Filesystem.isdir, (ASCIIString,))
precompile(Base.success, (Base.Process,))
precompile(Base.Serializer.serialize_any, (Base.SerializationState{Base.Pipe}, ASCIIString,))
precompile(Base.redir_err, (Base.Cmd, Base.TTY,))
precompile(Base.unsafe_write, (Base.PipeEndpoint, Ptr{UInt8}, UInt32,))
precompile(Base.Serializer.serialize_array_data, (Base.Pipe, Array{Union{UTF8String, ASCIIString}, 1},))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Module,))
precompile(Base.Serializer.serialize_type_data, (Base.SerializationState{Base.Pipe}, DataType,))
precompile(Base.getindex, (Array{Union{UTF8String, ASCIIString}, 1}, Int32,))
precompile(Base.unsafe_convert, (Type{Ptr{UInt8}}, UTF8String,))
precompile(Base.promote_result, (Type{Bool}, Type{UInt8}, Type{UInt8}, Type{Union{}},))
precompile(Base.cstr, (ASCIIString,))
precompile(Base.unsafe_convert, (Type{Ptr{UInt8}}, Ptr{Void},))
precompile(Base.start, (Tuple{Base.Pipe, Base.Process},))
precompile(Base.unsafe_convert, (Type{Ptr{Ptr{UInt8}}}, Ptr{Void},))
precompile(Base.setup_stdio, (Base.Pipe, Bool,))
precompile(Base.cconvert, (Type{Ptr{UInt8}}, Ptr{Void},))
precompile(Base.promote_type, (Type{UInt8}, Type{Union{}},))
precompile(Base.unsafe_convert, (Type{Ptr{UInt8}}, ASCIIString,))
precompile(Base.convert, (Type{Base.IO}, Base.Pipe,))
precompile(Base.bytestring, (ASCIIString, ASCIIString,))
precompile(Base.cconvert, (Type{Ptr{UInt8}}, ASCIIString,))
precompile(Base.Serializer.serialize, (Base.Pipe, Expr,))
precompile(Base.link_pipe, (Base.PipeEndpoint, Bool, Base.PipeEndpoint, Bool,))
precompile(Base.spawn_opts_swallow, (Tuple{Base.Pipe, Base.TTY, Base.TTY},))
precompile(Base.call, (Type{Ref{Ptr{UInt8}}}, Array{Union{UTF8String, ASCIIString}, 1},))
precompile(Base.promote_rule, (Type{UInt8}, Type{Bool},))
precompile(Base.cconvert, (Type{Ptr{Ptr{UInt8}}}, Ptr{Void},))
precompile(Base.convert, (Type{Ptr{Void}}, Ptr{Void},))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, DataType,))
precompile(Base.promote_type, (Type{Bool}, Type{UInt8},))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, LineNumberNode,))
precompile(Base.Filesystem.rm, (Array{Any, 1}, ASCIIString,))
precompile(Base.arg_gen, (Base.Cmd,))
precompile(Base.unsafe_write, (Base.PipeEndpoint, Base.RefValue{UInt8}, Int32,))
precompile(Base.arg_gen, (UTF8String,))
precompile(Base.cconvert, (Type{Ptr{UInt8}}, UTF8String,))
precompile(Base.spawn, (Array{Any, 1}, Base.Cmd, Tuple{Base.Pipe, Base.TTY, Base.TTY}, Bool, Bool,))
precompile(Base.init_pipe!, (Array{Any, 1}, Base.PipeEndpoint,))
precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, ASCIIString,))
end
julia> import SnoopCompile
julia> push!(LOAD_PATH,".")
3-element Array{ByteString,1}:
"/usr/local/julia-9cda53d471/local/share/julia/site/v0.5"
"/usr/local/julia-9cda53d471/share/julia/site/v0.5"
"."
julia> SnoopCompile.@snoop "/tmp/kalman_compiles.csv" begin include("kalman.jl") end
Launching new julia process to run commands...
WARNING: unable to determine host cpu name.
INFO: Recompiling stale cache file /home/jeffw/.julia/lib/v0.5/StateSpace.ji for module StateSpace.
WARNING: unable to determine host cpu name.
WARNING: Method definition update(StateSpace.LinearGaussianSSM, Distributions.AbstractMvNormal, Array{T<:Any, 1}) in module StateSpace at /home/jeffw/.julia/v0.5/StateSpace/src/filter_types.jl:37 overwritten at /home/jeffw/.julia/v0.5/StateSpace/src/filter_types.jl:41.
WARNING: Method definition filter(StateSpace.AbstractGaussianSSM, Array{#T<:Any, N<:Any}, Distributions.AbstractMvNormal) in module StateSpace at /home/jeffw/.julia/v0.5/StateSpace/src/filter_types.jl:212 overwritten at /home/jeffw/.julia/v0.5/StateSpace/src/filter_types.jl:271.
done.
julia> using kalman
INFO: Recompiling stale cache file /home/jeffw/.julia/lib/v0.5/kalman.ji for module kalman.
WARNING: unable to determine host cpu name.
julia> data = SnoopCompile.read("/tmp/kalman_compiles.csv")
114x2 Array{Any,2}:
300667 "Base.Serializer.serialize(Base.SerializationState{Base.Pipe}, ASCIIString)"
332000 "Base.init_pipe!(Array{Any, 1}, Base.PipeEndpoint)"
380000 "Base.spawn(Array{Any, 1}, Base.Cmd, Tuple{Base.Pipe, Base.TTY, Base.TTY}, Bool, Bool)"
427000 "Base.cconvert(Type{Ptr{UInt8}}, UTF8String)"
432666 "Base.arg_gen(UTF8String)"
433667 "Base.unsafe_write(Base.PipeEndpoint, Base.RefValue{UInt8}, Int32)"
445667 "Base.arg_gen(Base.Cmd)"
473334 "Base.Filesystem.rm(Array{Any, 1}, ASCIIString)"
509000 "Base.Serializer.serialize(Base.SerializationState{Base.Pipe}, LineNumberNode)"
534000 "Base.promote_type(Type{Bool}, Type{UInt8})"
537667 "Base.Serializer.serialize(Base.SerializationState{Base.Pipe}, DataType)"
561333 "Base.convert(Type{Ptr{Void}}, Ptr{Void})"
577000 "Base.cconvert(Type{Ptr{Ptr{UInt8}}}, Ptr{Void})"
579000 "Base.promote_rule(Type{UInt8}, Type{Bool})"
585000 "Base.call(Type{Ref{Ptr{UInt8}}}, Array{Union{UTF8String, ASCIIString}, 1})"
626000 "Base.spawn_opts_swallow(Tuple{Base.Pipe, Base.TTY, Base.TTY})"
15736334 "Base.Serializer.serialize(Base.SerializationState{Base.Pipe}, Tuple{Int32})"
17247333 "Base.close(Base.Pipe)"
17338333 "Base.Serializer.serialize_any(Base.SerializationState{Base.Pipe}, UInt8)"
20657667 "Base.Serializer.serialize_cycle(Base.SerializationState{Base.Pipe}, QuoteNode)"
21525667 "Base.Serializer.serialize_array_data(Base.Pipe, Array{UInt8, 1})"
22706000 "Base.Serializer.serialize_cycle(Base.SerializationState{Base.Pipe}, Array{UInt8, 1})"
22843667 "Base.Serializer.serialize_cycle(Base.SerializationState{Base.Pipe}, LineNumberNode)"
24729334 "Base.Filesystem.lstat(ASCIIString)"
29160333 "Base.Serializer.serialize(Base.SerializationState{Base.Pipe}, Int32)"
31359334 "Base.flush(Base.PipeEndpoint)"
32412667 "Base.write(Base.Pipe, Array{UInt8, 1})"
41507000 "Base.Serializer.serialize_cycle(Base.SerializationState{Base.Pipe}, UInt8)"
42566000 "Base.check_open(Base.PipeEndpoint)"
44995667 "Base.Serializer.write_as_tag(Base.Pipe, Int32)"
70285667 "Base.Serializer.serialize_type(Base.SerializationState{Base.Pipe}, DataType)"
424645333 "Base.Serializer.serialize_any(Base.SerializationState{Base.Pipe}, Type{T<:Any})"
julia> blacklist = ["MIME"]
1-element Array{ASCIIString,1}:
"MIME"
julia> pc, discards = SnoopCompile.parcel(data[end:-1:1,2], subst=subst, blacklist=blacklist)
ERROR: UndefVarError: subst not defined
julia> pc, discards = SnoopCompile.parcel(data[end:-1:1,2],, blacklist=blacklist)
ERROR: syntax: unexpected ,
julia> pc, discards = SnoopCompile.parcel(data[end:-1:1,2], blacklist=blacklist)
(Dict("Base"=>UTF8String[" precompile(Base.Serializer.serialize_type, (Base.SerializationState{Base.Pipe}, DataType,))"," precompile(Base.Serializer.write_as_tag, (Base.Pipe, Int32,))"," precompile(Base.check_open, (Base.PipeEndpoint,))"," precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, UInt8,))"," precompile(Base.write, (Base.Pipe, Array{UInt8, 1},))"," precompile(Base.flush, (Base.PipeEndpoint,))"," precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, Int32,))"," precompile(Base.Filesystem.lstat, (ASCIIString,))"," precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, LineNumberNode,))"," precompile(Base.Serializer.serialize_cycle, (Base.SerializationState{Base.Pipe}, Array{UInt8, 1},))" … " precompile(Base.promote_type, (Type{Bool}, Type{UInt8},))"," precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, LineNumberNode,))"," precompile(Base.Filesystem.rm, (Array{Any, 1}, ASCIIString,))"," precompile(Base.arg_gen, (Base.Cmd,))"," precompile(Base.unsafe_write, (Base.PipeEndpoint, Base.RefValue{UInt8}, Int32,))"," precompile(Base.arg_gen, (UTF8String,))"," precompile(Base.cconvert, (Type{Ptr{UInt8}}, UTF8String,))"," precompile(Base.spawn, (Array{Any, 1}, Base.Cmd, Tuple{Base.Pipe, Base.TTY, Base.TTY}, Bool, Bool,))"," precompile(Base.init_pipe!, (Array{Any, 1}, Base.PipeEndpoint,))"," precompile(Base.Serializer.serialize, (Base.SerializationState{Base.Pipe}, ASCIIString,))"]),UTF8String[])
julia> SnoopCompile.write("/tmp/precompile", pc)
julia>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment