Zend Framework

More efficient differentiation between structs and arrays

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.5.0RC1
  • Fix Version/s: 1.5.1
  • Component/s: Zend_XmlRpc_Client
  • Labels:
    None
  • Fix Version Priority:
    Must Have

Description

Instead of iterating over each key, array_keys() in combination with range() is much faster to determine wheither it is an array or a struct.

Activity

Hide
Matthew Weier O'Phinney added a comment -

Scheduling for 1.0.3

Show
Matthew Weier O'Phinney added a comment - Scheduling for 1.0.3
Hide
Matthew Weier O'Phinney added a comment -

Updated and pushed to release branch as of r6938.

Show
Matthew Weier O'Phinney added a comment - Updated and pushed to release branch as of r6938.
Hide
Lars Strojny added a comment -

I'm sorry, but you change made it even worse. I attached a benchmark between our two strategies to differentiate.

Show
Lars Strojny added a comment - I'm sorry, but you change made it even worse. I attached a benchmark between our two strategies to differentiate.
Hide
Lars Strojny added a comment -

Here is my result:
array_reduce(): 1.23774003983
count()/range(): 0.39503288269

Show
Lars Strojny added a comment - Here is my result: array_reduce(): 1.23774003983 count()/range(): 0.39503288269
Hide
Matthew Weier O'Phinney added a comment -

Scheduling for 1.5.0RC2

Show
Matthew Weier O'Phinney added a comment - Scheduling for 1.5.0RC2
Hide
Matthew Weier O'Phinney added a comment -

Applied in trunk and 1.5 release branch

Show
Matthew Weier O'Phinney added a comment - Applied in trunk and 1.5 release branch
Hide
Matthew Weier O'Phinney added a comment -

This patch highlights a huge issue with array/struct detection.

With the patch applied, we now have a situation where passing an empty array to a field expecting an array now results in an invalid argument exception – because the empty array is incorrectly detected as a struct.

Before the patch was applied, we had the opposite siutation: passing an empty array to a field expecting a struct resulted in an invalid argument exception, because the empty array was detected as an array.

I'm re-opening the ticket, as we need to do some detection in the client for empty arrays and cast them to the appropriate types.

Show
Matthew Weier O'Phinney added a comment - This patch highlights a huge issue with array/struct detection. With the patch applied, we now have a situation where passing an empty array to a field expecting an array now results in an invalid argument exception – because the empty array is incorrectly detected as a struct. Before the patch was applied, we had the opposite siutation: passing an empty array to a field expecting a struct resulted in an invalid argument exception, because the empty array was detected as an array. I'm re-opening the ticket, as we need to do some detection in the client for empty arrays and cast them to the appropriate types.
Hide
Matthew Weier O'Phinney added a comment -

Fix committed in trunk in r8953 and in release-1.5 branch in r 8954. This should resolve all issues at this point.

Show
Matthew Weier O'Phinney added a comment - Fix committed in trunk in r8953 and in release-1.5 branch in r 8954. This should resolve all issues at this point.

People

Vote (0)
Watch (0)

Dates

  • Due:
    Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
2h
Original Estimate - 2 hours
Remaining:
2h
Remaining Estimate - 2 hours
Logged:
Not Specified
Time Spent - Not Specified