Of possible interest: https://github.com/simonster/StructsOfArrays.jl
--Tim On Tuesday, January 05, 2016 04:41:37 AM Jamie Brandon wrote: > Thanks :) > > In this case I'm not worried about compatibility with C but about reducing > pointer hops in a tree. I suppose that allowing pointers to be inlined into > arrays would require storing offsets in the array meta so the GC can find > them. I'll have to figure out something else. > > On Tuesday, 5 January 2016 04:11:01 UTC, Isaiah wrote: > > Are only transitively immutable types stored inline? > > > > > > Yes. You can check `isbits(T)`, which in this case returns false because > > `B.pointerfree == false`. > > > >> Is this documented > >> anywhere? > > > > Unfortunately, the only hint at the moment appears to be > > > > http://docs.julialang.org/en/release-0.4/devdocs/reflection/?highlight=isb > > its > > > > and probably a number of mailing list questions. > > > > The statement there remains true: if you are worried about C-compatible > > layout, check whether the type is `isbits`. > > > > On Mon, Jan 4, 2016 at 7:15 PM, Jamie Brandon < > > > > [email protected] <javascript:>> wrote: > >> This surprised me: > >> > >> immutable A > >> > >> a::UInt32 > >> b::UInt32 > >> c::UInt64 > >> d::UInt64 > >> > >> end > >> > >> sizeof(A[A(0,0,0,0), A(0,0,0,0)]) # 48 > >> > >> immutable B > >> > >> a::UInt32 > >> b::UInt32 > >> c::Vector{UInt64} > >> d::Vector{UInt64} > >> > >> end > >> > >> sizeof(B[B(0,0,[],[]), B(0,0,[],[])]) # 16 > >> > >> I expected the latter to also have size 48 ie 2xInt32, 2xPointer. Are > >> only transitively immutable types stored inline? Is this documented > >> anywhere?
