aboutsummaryrefslogtreecommitdiff
path: root/src/core/ngx_hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ngx_hash.c')
-rw-r--r--src/core/ngx_hash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/ngx_hash.c b/src/core/ngx_hash.c
index 2876318a3..0ee5e77ca 100644
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -164,10 +164,14 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
return NGX_ERROR;
}
- start = nelts / (ngx_cacheline_size / (2 * sizeof(void *)) - 1);
+ bucket_size = hinit->bucket_size - sizeof(void *);
+
+ start = nelts / (bucket_size / (2 * sizeof(void *)) - 1);
start = start ? start : 1;
- bucket_size = hinit->bucket_size - sizeof(void *);
+ if (hinit->max_size > 10000 && hinit->max_size / nelts < 100) {
+ start = hinit->max_size - 1000;
+ }
for (size = start; size < hinit->max_size; size++) {