Re: [PHP-DEV] More packed hash optimizations in array.c

2016-08-06 Thread Benjamin Coutu
Hi Xinchen, There is still a way we could make this work, if we'd simply check for nNumUsed == nNumOfElements as well. Because a packed array with nNumUsed equal to nNumOfElements must be consecutively indexed from zero onward without any gaps (no IS_UNDEF). I therefore propose to change array

Re: [PHP-DEV] More packed hash optimizations in array.c

2016-08-03 Thread Xinchen Hui
means alwasy start with index 0, like: $array = array(1 => 1, 2, 3, 4, 5, 6); this is also a packed array so, we can not do such opt only if offset == 0 thanks > > Ben > > > == Original == > From: Xinchen Hui > To: Benjamin Coutu > Date: Tue,

Re: [PHP-DEV] More packed hash optimizations in array.c

2016-08-03 Thread Benjamin Coutu
Hello Xinchen, Thanks for changing array_pad and array_rand accordingly, that's very good. I noticed a small improvement we could make to array_slice for the packed case: We can change line 3003: if ((Z_ARRVAL_P(input)->u.flags & HASH_FLAG_PACKED) && !preserve_keys) => if ((Z_ARRVAL_P(input)->u.

Re: [PHP-DEV] More packed hash optimizations in array.c

2016-08-01 Thread Xinchen Hui
_value, zcolval); } if zkey is NULL(index_key), then only add_next_index_zval is executed. do you have any reproduce script to show the broken? thanks > > Cheers, > > Benjamin > > == Original == > From: Xinchen Hui > To: Benjamin Coutu

Re: [PHP-DEV] More packed hash optimizations in array.c

2016-08-01 Thread Xinchen Hui
Hey On Thu, Jul 28, 2016 at 4:59 PM, Benjamin Coutu wrote: > Hello Xinchen, > > I have noticed two more cases where we could easily use packed arrays. > > 1. array_merge($packed1, $packed2, ...): > > In the quite common case where all arguments are packed arrays, the > resulting array can also b

[PHP-DEV] More packed hash optimizations in array.c

2016-07-28 Thread Benjamin Coutu
Hello Xinchen, I have noticed two more cases where we could easily use packed arrays. 1. array_merge($packed1, $packed2, ...): In the quite common case where all arguments are packed arrays, the resulting array can also be a packed array (as per documentation: "if the input arrays [...] contai