Issues

ZF-2090: More efficient differentiation between structs and arrays

Issue Type: Improvement Created: 2007-10-21T16:50:43.000+0000 Last Updated: 2008-03-21T18:50:47.000+0000 Status: Resolved Fix version(s): - 1.5.1 (25/Mar/08)

Reporter: Lars Strojny (lars) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_XmlRpc_Client

Related issues: Attachments: - array_vs_hash-more-efficient.diff

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.

Comments

Posted by Matthew Weier O'Phinney (matthew) on 2007-11-16T15:05:23.000+0000

Scheduling for 1.0.3

Posted by Matthew Weier O'Phinney (matthew) on 2007-11-26T10:18:08.000+0000

Updated and pushed to release branch as of r6938.

Posted by Lars Strojny (lars) on 2007-12-03T18:43:26.000+0000

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

Posted by Lars Strojny (lars) on 2007-12-03T18:44:23.000+0000

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

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-06T10:14:12.000+0000

Scheduling for 1.5.0RC2

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-06T20:00:39.000+0000

Applied in trunk and 1.5 release branch

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-17T13:17:41.000+0000

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.

Posted by Matthew Weier O'Phinney (matthew) on 2008-03-21T11:24:44.000+0000

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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts