mirror of
https://github.com/neovim/neovim.git
synced 2025-09-03 18:08:16 +00:00
vim-patch:8.1.1752: resizing hashtable is inefficient (#35563)
Problem: Resizing hashtable is inefficient.
Solution: Avoid resizing when the final size is predictable.
7b73d7ebf7
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -317,7 +317,7 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
|
||||
// Use specified size.
|
||||
minitems = MAX(minitems, ht->ht_used);
|
||||
// array is up to 2/3 full
|
||||
minsize = minitems * 3 / 2;
|
||||
minsize = (minitems * 3 + 1) / 2;
|
||||
}
|
||||
|
||||
size_t newsize = HT_INIT_SIZE;
|
||||
|
Reference in New Issue
Block a user