diff options
author | Dmitry Stogov <dmitry@zend.com> | 2016-10-26 15:23:33 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2016-10-26 15:23:33 +0300 |
commit | d3cfef435a65731735fcf36f1b392c2ba5817ca5 (patch) | |
tree | d5b900685d44f3c1541f88380482d70d6f688ad3 /Zend/zend_alloc.c | |
parent | 356c162f54681a6a8a1013a85ea2c76301eb0630 (diff) | |
parent | 4616441980b5c770c54bb809139810cb61824997 (diff) | |
download | php-git-d3cfef435a65731735fcf36f1b392c2ba5817ca5.tar.gz |
Merge branch 'PHP-7.1'
* PHP-7.1:
Fixded bug #72736 (Slow performance when fetching large dataset with mysqli / PDO)
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r-- | Zend/zend_alloc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index f52ce7985e..a3003a457a 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -851,6 +851,7 @@ static void *zend_mm_alloc_pages(zend_mm_heap *heap, uint32_t pages_count ZEND_F { zend_mm_chunk *chunk = heap->main_chunk; uint32_t page_num, len; + int steps = 0; while (1) { if (UNEXPECTED(chunk->free_pages < pages_count)) { @@ -1027,10 +1028,20 @@ get_chunk: goto found; } else { chunk = chunk->next; + steps++; } } found: + if (steps > 2 && pages_count < 8) { + /* move chunk into the head of the linked-list */ + chunk->prev->next = chunk->next; + chunk->next->prev = chunk->prev; + chunk->next = heap->main_chunk->next; + chunk->prev = heap->main_chunk; + chunk->prev->next = chunk; + chunk->next->prev = chunk; + } /* mark run as allocated */ chunk->free_pages -= pages_count; zend_mm_bitset_set_range(chunk->free_map, page_num, pages_count); |