]> granicus.if.org Git - php/commit
Reduced initial VM_STACK page size of Generators to 4 KB (256 slots)
authorBob Weinand <bobwei9@hotmail.com>
Sat, 7 Mar 2015 12:07:18 +0000 (13:07 +0100)
committerBob Weinand <bobwei9@hotmail.com>
Sat, 7 Mar 2015 12:25:21 +0000 (13:25 +0100)
commitafad979c60e4b54b65a6fd7345d476076a7a9a03
tree3e22caa5d9404b521a65e163609e124a4847ef7b
parent0b7896cca54a6e7bb0fd930a845c7a00a20e8ffd
Reduced initial VM_STACK page size of Generators to 4 KB (256 slots)
Generators all have their own vm_stack, but usually don't go really deep.
In most cases even most of the 4 KB will remain unused (in my tests average is rather 1 KB), but this was tested a straightforward implementation without a lot of abstraction layers.
That way I'm using a more conservative 4 KB stack size which really should be enough for, I think, at least 90% of the cases.
This was necessary to not immediately run out of memory with 95%+ usused vm_stack space: If you have a few thousands of Generators active, your application quickly hits memory_limit with a stack page size of 256 KB...
In addition, it's also a bit faster (70% less instructions for zend_vm_stack_new_page) due to emalloc() not having to allocate a whole new segment (segment size 256 KB). Also no mmap()/malloc() necessary.
Zend/zend_execute.c