Hi,
I have a this kind of data structure :
type Ions_frag{}
mz::Float64
intensity::Float64
charge::Int64
end
I read in performance tips that it is better to define the type of the data
structure but I cannot find the good one for my data structure. I tried :
type Ions_frag{DataType}
On Tue, Jul 12, 2016 at 10:56 AM, Fred wrote:
> Hi,
>
> I have a this kind of data structure :
>
> type Ions_frag{}
> mz::Float64
> intensity::Float64
> charge::Int64
> end
>
>
> I read in performance tips that it is better to define the type of the data
Which one are you referring to?
> s
I am referring to all 3, ie the type of Ions_frag :)
Initially I used :
type Ions_frag
mz::Float64
intensity::Float64
charge::Int64
end
and it works. But, after reading the documentation I "understood" that it
is not optimal in performances.
Le mardi 12 juillet 2016 16:59:57 UTC+2, Y
On Tue, Jul 12, 2016 at 11:10 AM, Fred wrote:
> I am referring to all 3, ie the type of Ions_frag :)
Well, can you quote the performance tip? There's nothing wrong with
the type you are using in terms of performance so I'd like to know
which part of the doc is misleading.
> Initially I used :
>
You may be misreading the guidance. There is no advantage to putting a
parameter into the type when that parameter is not used anywhere.
type Ions_frag
mz::Float64
intensity::Float64
charge::Int64
end
if your use involves changing the fields' values after creating an
ions_frag typed
I use a dictionary to store values :
for example :
d = Dict()
d["key1"] = Ions_frag(501.5, 1500, 3)
Then to obtain the values :
d["key1"].mz # = 501.5
My problem was to store many values in one object. So I found this
solution, I don't know if it is the best and I hope this approach is
corr
I tried that "change" because of this part of the documentation (in
http://docs.julialang.org/en/release-0.4/manual/performance-tips/) :
For example:
julia> type MyType{T<:AbstractFloat}
a::T
end
This is a better choice than
julia> type MyStillAmbiguousType
a::AbstractF
On Tue, Jul 12, 2016 at 12:23 PM, Fred wrote:
> I tried that "change" because of this part of the documentation (in
> http://docs.julialang.org/en/release-0.4/manual/performance-tips/) :
>
> For example:
>
> julia> type MyType{T<:AbstractFloat}
> a::T
>end
> This is a better choic
What might be missing is to note the important difference between abstract and
concrete types. Otherwise it might indeed be interpreted as advice to use
curly-brackets in your type definitions.
Best,
--Tim
On Tuesday, July 12, 2016 12:36:28 PM CDT Yichao Yu wrote:
> On Tue, Jul 12, 2016 at 12:2
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 :
type Ions_frag
mz::Float64
intensity::Float64
charge::Int64
end
But if I use :
d = Dict()
d["key1"] = Ions_f
On Tue, Jul 12, 2016 at 1:21 PM, Fred 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
rep
Thank you very much Yichao,
I will try :
Dict{Any,Ions_frag}
and
immutable Ions_frag
mz::Float64
intensity::Float64
charge::Int64
end
Hi !
Here are the results :
type Ions_frag{}
mz::Float64
intensity::Float64
charge::Int64
end
computation time : 26.88 s
immutable Ions_frag
mz::Float64
intensity::Float64
charge::Int64
end
computation time : 27.00 s
Ions = Dict{ASCIIString, Ions_frag}()
immutable Ion
13 matches
Mail list logo