[ ] try to reuse former allocation when chaining create functions, often the former allocation is forgotten for no reason... But reusing the allocation is perhaps a prime reason to reuse the Image?
[ ] allocating storage should return a slice, and take a slice for former allocation
Is realloc worth it vs free+malloc? Sometimes yes.
// PERF: on Windows, reusing previous allocation is much faster for same alloc size
// 314x faster vs free+malloc for same size
// 10x faster vs free+malloc for decreasing size 1 by 1
// 424x slower (quadratic) vs free+malloc for increasing size 1 by 1
// 0.5x slower vs free+malloc for random size
If we store the allocation as slice, we could second guess realloc().
[ ] try to reuse former allocation when chaining create functions, often the former allocation is forgotten for no reason... But reusing the allocation is perhaps a prime reason to reuse the Image?
[ ] allocating storage should return a slice, and take a slice for former allocation
Is realloc worth it vs free+malloc? Sometimes yes.
If we store the allocation as slice, we could second guess realloc().