2 ms·
Make sure you don't miss this part: > PHP uses hashtables for all arrays. However in the rather common case of continuous, integer-indexed arrays (i.e. real ar
by halflings 12y ago
Make sure you don't miss this part:
> PHP uses hashtables for all arrays. However in the rather common case of continuous, integer-indexed arrays (i.e. real arrays) the whole hashing thing doesn’t make much sense. This is why PHP 7 introduces the concept of “packed hashtables”.
> [...] We keep these useless values around so that buckets always have the same structure, independently of whether or not packing is used. This means that iteration can always use the same code. However we might switch to a “fully packed” structure in the future, where a pure zval array is used if possible.
It's nice that they're starting to consider the fact that "real" arrays are unnecessarily mixed with hashtables, which comes with a pretty significant overhead. Let's hope they'll soon add that different separate type for arrays (or "fully packed hashtables" if they prefer :)).
- scotty79 12y ago> Let's hope they'll soon add that different separate type for arrays (or "fully packed hashtables" if they prefer :)). Could be good as long as it can be inferred whether compiler should use it or not, without additional clutter in the code.