Hi all,
I am looking into zend op_array structure, and few questions raised in my
mind:
-
Why op_array->refcount uses *uint32 instead of uint32, is there a
reason? if we can replace it with uint32, then we might save one emalloc
call for memory allocation for every op_array allocation? -
There are also a lot of information saved in the op_array structure, if
we can move line_start, line_end, doc_comments...etc into an external
structure, then we might be able to reduce the op_array size and decrease
the cache miss? is it doable?
Cheers,
Yo-An Lin
https://github.com/c9s
Hi all,
I am looking into zend op_array structure, and few questions raised in my
mind:
- Why op_array->refcount uses *uint32 instead of uint32, is there a
reason? if we can replace it with uint32, then we might save one emalloc
call for memory allocation for every op_array allocation?
We may have few different op_array structures with the same opcodes but
with different names for example. So just uint32won't work.
- There are also a lot of information saved in the op_array structure,
if we can move line_start, line_end, doc_comments...etc into an external
structure, then we might be able to reduce the op_array size and decrease
the cache miss? is it doable?
I'm not sure if patritioning data of op_array, into frequntly and rarely
used, may make any significant difference. Because we usually work only
with a single instance of op_array in each moment. Fields reordering alrecy
helped to reduce cache-misses. But I may be wrog :)
Thanks. Dmitry.
Cheers,
Yo-An Lin
https://github.com/c9s
Hi Dmitry,
I changed and tested it, and it looks like it gains some improvements. how
do you compare the benchmark result? is there a tool doing it?
I currently do:
./sapi/cli/php Zend/bench.php
The result:
https://gist.github.com/4bbc33b7b5dcedc6bd66
Hi all,
I am looking into zend op_array structure, and few questions raised in
my mind:
- Why op_array->refcount uses *uint32 instead of uint32, is there a
reason? if we can replace it with uint32, then we might save one emalloc
call for memory allocation for every op_array allocation?We may have few different op_array structures with the same opcodes but
with different names for example. So just uint32won't work.
- There are also a lot of information saved in the op_array structure,
if we can move line_start, line_end, doc_comments...etc into an external
structure, then we might be able to reduce the op_array size and decrease
the cache miss? is it doable?I'm not sure if patritioning data of op_array, into frequntly and rarely
used, may make any significant difference. Because we usually work only
with a single instance of op_array in each moment. Fields reordering alrecy
helped to reduce cache-misses. But I may be wrog :)Thanks. Dmitry.
Cheers,
Yo-An Lin
https://github.com/c9s
--
Best Regards,
Yo-An Lin
Hey Lin:
Hi Dmitry,
I changed and tested it, and it looks like it gains some improvements. how
do you compare the benchmark result? is there a tool doing it?I currently do:
./sapi/cli/php Zend/bench.php
The result:
Acutally, simply bench.php testing is very un-stable. in generally, we
prefer using real-life app to test, like wordpress.
Basically, we use callgrind to collect the IRs , like valgrind
--tool=callgrind --instr-atstart=yes php-cgi -T 100 wordpress/index.php ( I
may type args wrong).
But in this case(cache friendly), you may try to use perf to collect cache
miss changing.
thanks
Hi all,
I am looking into zend op_array structure, and few questions raised in
my mind:
- Why op_array->refcount uses *uint32 instead of uint32, is there a
reason? if we can replace it with uint32, then we might save one emalloc
call for memory allocation for every op_array allocation?We may have few different op_array structures with the same opcodes but
with different names for example. So just uint32won't work.
- There are also a lot of information saved in the op_array structure,
if we can move line_start, line_end, doc_comments...etc into an external
structure, then we might be able to reduce the op_array size and decrease
the cache miss? is it doable?I'm not sure if patritioning data of op_array, into frequntly and rarely
used, may make any significant difference. Because we usually work only
with a single instance of op_array in each moment. Fields reordering alrecy
helped to reduce cache-misses. But I may be wrog :)Thanks. Dmitry.
Cheers,
Yo-An Lin
https://github.com/c9s--
Best Regards,Yo-An Lin
--
Xinchen Hui
@Laruence
http://www.laruence.com/
Hi Hui,
Hey Lin:
On Fri, Oct 23, 2015 at 3:31 PM, Lin Yo-An cornelius.howl@gmail.com
wrote:Hi Dmitry,
I changed and tested it, and it looks like it gains some improvements.
how do you compare the benchmark result? is there a tool doing it?I currently do:
./sapi/cli/php Zend/bench.php
The result:
Acutally, simply bench.php testing is very un-stable. in generally, we
prefer using real-life app to test, like wordpress.Basically, we use callgrind to collect the IRs , like valgrind
--tool=callgrind --instr-atstart=yes php-cgi -T 100 wordpress/index.php ( I
may type args wrong).But in this case(cache friendly), you may try to use perf to collect cache
miss changing.
Thanks! it's helpful!