cakephp/cakephp — pull request #4532 by jrbasso (2014-09-07 22:32:52+00:00)
Title: 3.0 Hash get/extract performance improvements

I made couple performance improvements on the methods `get` and `extract`:
- Using `array_column()` function on `Hash::extract()` when available (PHP 5.5+). It increases the performance in about **84%** when using PHP 5.5+ and the path has the format `{n}.field`. The downside is it decreases the performance in about 4.5% when the format doesn't match on PHP 5.5+ and about 2% on PHP 5.4 in any case.
- Since PHP 5.3 the variables are no longer duplicated in memory, so I removed the reference assignment on `Hash::get()`. It improves the performance in about 2%.
- Since `Hash::get()` is not recursive, I removed the check that verifies if the path is a single field. Incredibly it increased the performance in about 15%.
- Since we use `Hash::get()` for many things internally, such as configurations, I added a quick check for up 3 levels. If the the path has up to 3 levels the code will check by `isset` instead of loop thru the array and find it. It increased the performance in about 30% for up 3 levels. I didn't check how much it decreased by lazy reasons (:stuck_out_tongue_winking_eye:), but it shouldn't be much and the improvement for the reference variable should compensate it.

In general, the `Hash::get()` method is about 43% faster if contains up to 3 levels.

PS: I tried to use `array_column()` combine on `Hash::combine()` as well, but the method has custom formats, which could make the method complicated to read. I don't know how often people use it with the format `{n}.field1`, `{n}.field2` to compensate the readability downside.