|
|
|
|
|
by chrisseaton
1917 days ago
|
|
> do you think that memory allocation is always bumping a pointer a uniform amount with no memory being freed, no variance in allocation size and no interlaced lifetimes? In modern language implementations with moving collectors allocation is literally what I've described in the fast path. Not theoretical. That's literally the instructions used. > You originally said that memory allocation was 'just a few instructions' Here it is in a real industrial compiler and garbage collector, for example. https://github.com/oracle/graal/blob/f9530b0948c58a66845e84f... It's precisely as I've described. |
|
You are only on the 'fast path' when a single allocation of an array would have been much faster anyway. It isn't difficult to be 'fast' when accomplishing something trivial that would be even faster if done directly.
Why do you keeping saying the same thing while ignoring freeing memory, different lifetimes and wildly different sizes of allocations (which are why memory allocators actually exist)?
This idea that memory allocation is cheap is a blight on performance. Are you really allocating memory inside your hot loops and having it not show up when you profile?