Runtime speed is, as noted, going to be similar, with the winner being determined by which compiler optimisations benefit your code the most.<p>Yes you could also pre-allocate, but that&#x27;s often more awkward than just allocating at the time of need, and besides, Java can turn heap allocations into not only stack allocations, but fully scalarise them (i.e. break down an allocation into a set of local variables and then delete any that are unused, move them around, etc).