]> git.eshelyaron.com Git - emacs.git/commit
Use heuristic to speed up allocation of small vectors (bug#65491)
authorMattias Engdegård <mattiase@acm.org>
Mon, 25 Sep 2023 15:19:00 +0000 (17:19 +0200)
committerMattias Engdegård <mattiase@acm.org>
Mon, 25 Sep 2023 15:33:21 +0000 (17:33 +0200)
commit091b8de586efc41c3dbd8606445c99c541e90076
tree492d61f5c27b628eff5df7c332da384dcff4c41b
parentaa28527500210e542349cca3cd805a61a01c9dac
Use heuristic to speed up allocation of small vectors (bug#65491)

Instead of scanning vector_free_lists from the appropriate size until
we find a nonempty bucket, start at the last bucket where we last put
something in.  This may favour splitting larger vectors than necessary
but in general saves a lot of time in the allocation of small vectors.

Original patch by Ihor Radchenko.

* src/alloc.c (last_inserted_vector_free_idx): New variable.
(setup_on_free_list): Set it.
(allocate_vector_from_block): Use it.
(sweep_vectors): Reset it.
src/alloc.c