mirror of
https://github.com/neovim/neovim.git
synced 2026-05-06 16:29:57 -04: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. https://github.com/vim/vim/commit/7b73d7ebf71c9148c90a500116f25ec2314c7273 Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
+1
-1
@@ -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