Use Valuedict[atom]=values instead of merge!(ValueDict, Dict((atom)=>values)). The latter allocates an entire new Dict for every guy you want to put in.
A merge-combine that uses only a single hash eval is unfortunately missing in Base, but your combine function is “overwrite” anyway, so you get away with setindex!.
Also, are you sure that you can’t make your keys concretely typed? A Dict{Function, Foo_T} is barely better than a Dict{Any, Foo_T}.
Are your functions really “function functions” or are they closures (a single parametrized function)?
If they are closures, then you can define
struct Foo_func{T1,T2,T3}<:Function
param1::T1
param2::T2
param3::T3
end
function (foo::Foo_func)(x)
#do something with x and foo.param1, foo.param2, foo.param3
end
valdict=Dict{Foo_func{Float64, Bool, Int32}, Array{Float64, 1}}()
PS: Regarding functions as arguments: Think very well on whether you want to dispatch on
function bar(foo::Function, x)
#....
end
or
function bar(foo:T, x) where {T<:Function}
#....
end
Both are semantically the same, but the second version tells julia to always specialize on the specific function, and the first allows julia to use heuristics to decide whether to specialize or not. That can save compile time, but can cost runtime. @code_native, @code_llvm, @code_warntype etc will lie to you if you use the first definition: They will tell you the code for the second definition while julia will in reality compile the first version (they will show you the fully realized method instead of the really existing method). This makes for very unfun profiling sessions.
Both are semantically the same, but the second version tells julia to always specialize on the specific function, and the first allows julia to use heuristics to decide whether to specialize or not. That can save compile time, but can cost runtime. @code_native , @code_llvm , @code_warntype etc will lie to you if you use the first definition: They will tell you the code for the second definition while julia will in reality compile the first version (they will show you the fully realized method instead of the really existing method). This makes for very unfun profiling sessions.