I apologise in advance if this is total nonsense, which it may very well be.
However, some results I get seem to indicate that the current implementation of push! does not always allocate. This is consistent with my understanding that growing arrays happens by doubling when necessary?? Is this correct? push! calls jl_array_grow_end, and perhaps this is a no-op if array doesn't need to grow?? On Thursday, March 17, 2016 at 1:58:58 PM UTC+11, Cedric St-Jean wrote: > Not part of Michele's PR, but I just saw this definition: > > push!(A, a, b, c...) = push!(push!(A, a, b), c...) > > Doesn't it make the vector reallocate+copy many times instead of just once? > > On Wednesday, March 16, 2016 at 9:45:02 AM UTC-4, Stefan Karpinski wrote: >> >> Yes, wonderful! Thanks for contributing it. If you add a test, it'll get >> merged rapidamente. >> >> On Wed, Mar 16, 2016 at 4:03 AM, Michele Zaffalon <[email protected]> >> wrote: >> >>> Something like this <https://github.com/JuliaLang/julia/pull/15529>? >>> >>> On Tue, Mar 15, 2016 at 7:28 PM, Stefan Karpinski <[email protected]> >>> wrote: >>> >>>> It's just an absent feature – if you'd open an issue, I'm sure someone >>>> will add it shortly. It would make a pretty good intro issue. >>>> >>>> On Tue, Mar 15, 2016 at 12:43 PM, Michele Zaffalon < >>>> [email protected]> wrote: >>>> >>>>> I have some arrays I would like to `append!` to the first. At the >>>>> moment I do >>>>> >>>>> reduce(append!, array_1, [array_2, array_3, ...]), >>>>> >>>>> but I would like to write >>>>> >>>>> append!(array_1, array_2, array_3, ...) >>>>> >>>>> just like for `push!`ing several items into the collection. Why is >>>>> this not allowed? >>>>> >>>>> Thank you, >>>>> michele >>>>> >>>>> >>>>> >>>> >>> >>
