On Tue, Jul 12, 2016 at 1:21 PM, Fred <[email protected]> wrote:
> Thank you very much Yichao, Tim and Jeffrey for your answers !
>
> I try to summarize. If I understand well, this type definition is correct
> and gives the maximum performances :

It is the best for performance in terms of the field types. If you
replace the `type` with `immutable` it might further improve
performance if you don't need to mutate it.

>
> type Ions_frag
>    mz::Float64
>    intensity::Float64
>    charge::Int64
> end
>
>
>
> But if I use :
>
> d = Dict()
>
> d["key1"] = Ions_frag(501.5, 1500, 3)
>
>
>
> the type of d is unstable and gives poor performances. So, if we assume that

The type of `d` is stable (from this single assignment anyway) the
thing you load from it is not.

> "key1" is a String, do you think that I can improve performances like that ?
> :
>
> d = Dict{AbstractString,Any}

You need `Dict{AbstractString,Any}()` and no, narrowing down to an
abstract type won't help too much (and especially not for the key
type) `Dict{Any,Ions_frag}` should be much better.

>
> d["key1"] = Ions_frag(501.5, 1500, 3)
>
>
>

Reply via email to