Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread John Myles White
Done: https://github.com/JuliaLang/julia/issues/8269

 — John

On Sep 7, 2014, at 1:38 PM, Kevin Squire  wrote:

> Interesting read!  How about opening an issue?
> 
> On Sunday, September 7, 2014, John Myles White  
> wrote:
> Since we’re on this topic, I recently discovered this document in one of FB’s 
> open source libraries for C++: 
> https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md
> 
> It makes an interesting argument for growing arrays by a factor smaller than 
> 2 when resizing them so that you can reuse memory more easily. Not sure how 
> much you also need to use a custom malloc routine to get the benefits being 
> claimed, though.
> 
>  — John
> 
> On Sep 7, 2014, at 11:38 AM, Kevin Squire  wrote:
> 
>> More specifically, the underlying array size starts at 16 elements and 
>> doubles whenever it grows beyond it's underlying size. (This might change 
>> when the array gets large, but I haven't looked at that code recently, so I 
>> forget the details.)
>> 
>> Cheers,
>>Kevin
>> 
>> On Sunday, September 7, 2014, John Myles White  
>> wrote:
>> It gets expanded in chunks.
>> 
>>  — John
>> 
>> On Sep 7, 2014, at 10:15 AM, Steven Sagaert  wrote:
>> 
>> > When you start with an empty array and grow it one element at a time with 
>> > push!, does the underlying array memory block get copied & expanded by one 
>> > or in larger chunks (like ArrayList in Java)?
>> 
> 



Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread Kevin Squire
Interesting read!  How about opening an issue?

On Sunday, September 7, 2014, John Myles White 
wrote:

> Since we’re on this topic, I recently discovered this document in one of
> FB’s open source libraries for C++:
> https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md
>
> It makes an interesting argument for growing arrays by a factor smaller
> than 2 when resizing them so that you can reuse memory more easily. Not
> sure how much you also need to use a custom malloc routine to get the
> benefits being claimed, though.
>
>  — John
>
> On Sep 7, 2014, at 11:38 AM, Kevin Squire  > wrote:
>
> More specifically, the underlying array size starts at 16 elements and
> doubles whenever it grows beyond it's underlying size. (This might change
> when the array gets large, but I haven't looked at that code recently, so I
> forget the details.)
>
> Cheers,
>Kevin
>
> On Sunday, September 7, 2014, John Myles White  > wrote:
>
>> It gets expanded in chunks.
>>
>>  — John
>>
>> On Sep 7, 2014, at 10:15 AM, Steven Sagaert 
>> wrote:
>>
>> > When you start with an empty array and grow it one element at a time
>> with push!, does the underlying array memory block get copied & expanded by
>> one or in larger chunks (like ArrayList in Java)?
>>
>>
>


Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread John Myles White
Since we’re on this topic, I recently discovered this document in one of FB’s 
open source libraries for C++: 
https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md

It makes an interesting argument for growing arrays by a factor smaller than 2 
when resizing them so that you can reuse memory more easily. Not sure how much 
you also need to use a custom malloc routine to get the benefits being claimed, 
though.

 — John

On Sep 7, 2014, at 11:38 AM, Kevin Squire  wrote:

> More specifically, the underlying array size starts at 16 elements and 
> doubles whenever it grows beyond it's underlying size. (This might change 
> when the array gets large, but I haven't looked at that code recently, so I 
> forget the details.)
> 
> Cheers,
>Kevin
> 
> On Sunday, September 7, 2014, John Myles White  
> wrote:
> It gets expanded in chunks.
> 
>  — John
> 
> On Sep 7, 2014, at 10:15 AM, Steven Sagaert  wrote:
> 
> > When you start with an empty array and grow it one element at a time with 
> > push!, does the underlying array memory block get copied & expanded by one 
> > or in larger chunks (like ArrayList in Java)?
> 



Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread Kevin Squire
More specifically, the underlying array size starts at 16 elements and
doubles whenever it grows beyond it's underlying size. (This might change
when the array gets large, but I haven't looked at that code recently, so I
forget the details.)

Cheers,
   Kevin

On Sunday, September 7, 2014, John Myles White 
wrote:

> It gets expanded in chunks.
>
>  — John
>
> On Sep 7, 2014, at 10:15 AM, Steven Sagaert  > wrote:
>
> > When you start with an empty array and grow it one element at a time
> with push!, does the underlying array memory block get copied & expanded by
> one or in larger chunks (like ArrayList in Java)?
>
>


Re: [julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread John Myles White
It gets expanded in chunks.

 — John

On Sep 7, 2014, at 10:15 AM, Steven Sagaert  wrote:

> When you start with an empty array and grow it one element at a time with 
> push!, does the underlying array memory block get copied & expanded by one or 
> in larger chunks (like ArrayList in Java)?



[julia-users] when you do push! on an array does it get copied each time or in chunks?

2014-09-07 Thread Steven Sagaert
When you start with an empty array and grow it one element at a time with 
push!, does the underlying array memory block get copied & expanded by one 
or in larger chunks (like ArrayList in Java)?