We should have an InlineOrHeap sequence/collection that uses an InlineArray to some extent, and more than that it allocates on heap.
This will avoid allocating on heap when there are not enough values to justify so.
This can be pretty useful in performance-sensitive code.
Something along the lines of:
enum InlineOrHeap<let count: Int, Element> {
case inline(InlineArray<count, Element>)
case heap(Array<Element>)
}
Usage:
let tinyValue: InlineOrHeap<8, Int> = ...
We should have an
InlineOrHeapsequence/collection that uses anInlineArrayto some extent, and more than that it allocates on heap.This will avoid allocating on heap when there are not enough values to justify so.
This can be pretty useful in performance-sensitive code.
Something along the lines of:
Usage: