It’s a while I wonder if a Persistent/Clear is faster than a TempJob allocation. Didn’t bother to check for lack of time, but I am interested in your thoughts
Check this out
1 Like
I always use persistent and clear (in job), as long as it makes sense.
This doesn’t really compare allocating vs clearing though.
2 Likes
if the Arrays are big there is the chance that temp allocation may be faster than clear.
I now wonder how the different allocators are implemented, the difference is too big to be just mallocs
Depends on container, for example a clear on native list just sets length to 0. Doubt any allocation will be faster than that. In general most clears are pretty fast like this, and the ones that aren’t like hashmap call clear on allocation anyway…
1 Like