Subject: bug#65491: [PATCH] Improve performance allocating vectors

From: Mattias Engdegård <[email-masked]>
Date: Sat, 26 Aug 2023 14:01:48 +0200

First of all, let's leave bignums out of this entirely. They are not relevant here.

Second, please do not motivate any perceived performance problem from benchmarks found on the internet, especially anything derived from the Gabriel benchmarks. This includes the benchmarks in ELPA.

That said, vectorlike object allocation in general is definitely relevant and can certainly be improved but I'm not persuaded by the proposed patch. Please do not apply it right away.

However, the important part is not the patch but the problem it highlights, and here there is evidently plenty to do. 

For example:

- isn't vector_free_list twice as big as it needs to be?
- 4096 bytes for vector blocks seems a tad small
- to what extent are we duplicating the work done by modern libc allocators (very generously including glibc here)?
- not happy with the way struct vector_block co-allocates metadata with a big power-of-two data chunk
- next_vector is a dangerously unstable concoction of C undefined behaviour

and so on.