summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-05-29 10:16:02 +0300
committerDmitry Stogov <dmitry@zend.com>2018-05-29 10:16:02 +0300
commit44be0fa67b46506353c3dd27d97801bd0eddbb00 (patch)
tree618398737b556a65231182e16ef1f3687af7825a
parent37069d7d2fbafb816e37b74e2592283da808ee80 (diff)
downloadphp-git-44be0fa67b46506353c3dd27d97801bd0eddbb00.tar.gz
Fixed HashTable load factor
-rw-r--r--ext/opcache/zend_persist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index 231c509571..fd5defdf23 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -207,17 +207,17 @@ static void zend_hash_persist_immutable(HashTable *ht)
}
if (HT_FLAGS(ht) & HASH_FLAG_PACKED) {
HT_SET_DATA_ADDR(ht, zend_accel_memdup(HT_GET_DATA_ADDR(ht), HT_USED_SIZE(ht)));
- } else if (ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 2) {
+ } else if (ht->nNumUsed < (uint32_t)(-(int32_t)ht->nTableMask) / 4) {
/* compact table */
void *old_data = HT_GET_DATA_ADDR(ht);
Bucket *old_buckets = ht->arData;
uint32_t hash_size;
if (ht->nNumUsed <= HT_MIN_SIZE) {
- hash_size = HT_MIN_SIZE;
+ hash_size = HT_MIN_SIZE * 2;
} else {
hash_size = (uint32_t)(-(int32_t)ht->nTableMask);
- while (hash_size >> 1 > ht->nNumUsed) {
+ while (hash_size >> 2 > ht->nNumUsed) {
hash_size >>= 1;
}
}