diff src/core/ngx_hash.c @ 631:5d2b8078c1c2 release-0.3.37

nginx-0.3.37-RELEASE import *) Feature: the "limit_except" directive. *) Feature: the "if" directive supports the "!~", "!~*", "-f", and "!-f" operators. *) Feature: the ngx_http_perl_module supports the $r->request_body method. *) Bugfix: in the ngx_http_addition_filter_module.
author Igor Sysoev <igor@sysoev.ru>
date Fri, 07 Apr 2006 14:08:04 +0000
parents 7a16e281c01f
children 1e720b0be7ec
line wrap: on
line diff
--- a/src/core/ngx_hash.c
+++ b/src/core/ngx_hash.c
@@ -164,10 +164,14 @@ ngx_hash_init(ngx_hash_init_t *hinit, ng
         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++) {