Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread Jason Merrill
On Friday, December 19, 2014 12:10:31 PM UTC-8, Jim Garrison wrote: > > > > On Friday, December 19, 2014 10:12:42 AM UTC-8, Tim Holy wrote: >> >> Julia's arrays grow by doubling, see >> http://en.wikipedia.org/wiki/Dynamic_array >> > > Is it strictly true that arrays in Julia grow by a factor of

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread Jim Garrison
On Friday, December 19, 2014 10:12:42 AM UTC-8, Tim Holy wrote: > > Julia's arrays grow by doubling, see > http://en.wikipedia.org/wiki/Dynamic_array > Is it strictly true that arrays in Julia grow by a factor of two on each reallocation? It has been argued (see e.g. https://github.com/face

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread Tim Holy
On Friday, December 19, 2014 10:34:32 AM John Drummond wrote: > And will increasing the size beyond the maximum always copy the whole array? Yes, because Arrays are required to be contiguous. But if you don't need that, https://github.com/tanmaykm/ChainedVectors.jl might be of some interest to you

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread John Drummond
Great, thank you. On Friday, December 19, 2014 6:37:03 PM UTC, John Myles White wrote: > > The problem is that your let block is not a proper function body. You need > to time things inside of a function body: > > julia> function foo() > @time a1 = zeros(Int64,1000) >

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread John Myles White
The problem is that your let block is not a proper function body. You need to time things inside of a function body: julia> function foo() @time a1 = zeros(Int64,1000) @time resize!(a1, 1000) @time resize!(a1, 1000) @time resize!(a1,

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread John Drummond
Sorry to be stupid - but this also helps me understand things for another question: So bytes allocated would be the underlying usage of memory. in which case with julia> let @time a1 = zeros(Int64,1000) @time resize!(a1, 1000) @time resize!(a1, 1000) @time resi

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread John Drummond
Ah. Yes. Though I was only really interested initially in what happened with the memory. putting it in a let clause gives me julia> let @time c = [1,2] sizeof(c) @time for x in 30:39 push!(c, x) end @time for x in 30:39 push!(c, x) end @time for x in 30:39 push!(

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread Tim Holy
Julia's arrays grow by doubling, see http://en.wikipedia.org/wiki/Dynamic_array Since you're appending elements to an array, julia has to have somewhere to put them---and when there's no spare capacity, julia has to allocate a new array and copy the entire thing. So some allocations are much bi

Re: [julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread John Myles White
Are you timing things in the global scope? -- John On Dec 19, 2014, at 1:00 PM, John Drummond wrote: > For the following code (julia 0.3.3 in windows 7 ) I don't understand what > the bytes allocated in @time means > > All I'm doing each time is adding 10 8 byte integers > > Thanks for any

[julia-users] any clarification of bytes allocated in @time?

2014-12-19 Thread John Drummond
For the following code (julia 0.3.3 in windows 7 ) I don't understand what the bytes allocated in @time means All I'm doing each time is adding 10 8 byte integers Thanks for any thoughts julia> @time c = [1,2] elapsed time: 3.32e-6 seconds (144 bytes allocated) 2-element Array{Int64,1}: 1 2