NativeArray< EntityAndPositionData > workArrayVersion1 = CollectionHelper.CreateNativeArray< EntityAndPositionData , RewindableAllocator >(
_workEntityQuery.CalculateEntityCount() , ref World.UpdateAllocator ) ;
// alternative way to make a list ?benefits between the two ?
NativeList< EntityAndPositionData > workArrayVersion2 = new NativeList< EntityAndPositionData >( _workEntityQuery.CalculateEntityCount() , Allocator.TempJob ) ;
There’s quite a big difference. Different container types. Different allocators. Different lifetime guarantees. Different disposal responsibilities. You get the idea.
As far as I understood it the first variant allows you to provide a custom allocator (like World.UpdateAllocator) while the second variant only works with the usual allocator labels (at least for NativeArray).
Pretty much. And you only really need CollectionHelper for NativeArray. Everything in the Collections package works with custom allocators via ToAllocator.