|
|
|
|
|
by amluto
5 days ago
|
|
It’s not so brilliant when you have an array of size 2^n and you append and then pop off the end in a loop and each operation takes time proportional to the length of the vector. Usually, dynamic arrays aim for amortized constant time for append and pop. This trick loses that property. |
|
More disappointing is that libc still forces us to use the free(p) API, without a length argument, meaning we are still paying to store a(n approximation of) the length somewhere in the allocation metadata.