Description

I've compared ZendAMF to AMFPHP, by returning a dataset with 5000+ rows from a table, using the exact same code (both in PHP, and AS3). ZendAMF averages a 16 second return time, whereas AMFPHP returns in 3 seconds. I'm guessing the added time is coming from the process of serializing data to send back to Flash.

Comments

Posted by Mark Reidenbach (mreiden) on 2010-09-22T14:10:50.000+0000

I cloned bug ZF-7493 in hopes that having a bug that has not been "fixed" will get someone to notice that the correct patch has not been applied yet.

Please apply patch "Amf.perform.ref-writeString-1.10.5.patch".

Posted by Ralph Schindler (ralph) on 2010-11-21T07:21:52.000+0000

Re-assigning to wade to have a look at suggested fix.

Posted by Ogre The Great (ogrethegreat) on 2010-12-21T09:47:38.000+0000

In addition to Mark's patch, the issue also effects Object serialization. Even with Mark's patch if one is encoding a large dataset of objects, the issue still appears. I've taken Mark's logic and used spl_object_hash() to get vastly improved performance for my needs. In essence, the performance drops exponentially as size of the array increases. Its even worse with the object array_search than it is with strings. I went ahead and put up the diff but this piece should probably be fixed to use SPL where available and otherwise require a UUID on any object passed to the serializer or some other logic along the lines. Point being is to build a hash to search on rather than exhaustive object comparison. Note this diff is based on the original. Mark made some other changes to pass the marker type which are not shown here.

I've applied both Mark's patch as well as the improvements suggested in the previous comment (with minor modifications -- I store the object hash locally so it doesn't need to be computed multiple times). The changes are in trunk in r23682. Please test, and, if the changes pose no issues AS WELL AS demonstrate better performance, please post a comment so I can merge to the 1.11 release branch.

Posted by Ralph Schindler (ralph) on 2011-05-28T21:39:08.000+0000

Can someone test this?

Posted by Mark Reidenbach (mreiden) on 2011-06-03T15:08:17.000+0000

I checked out revision 24104 and everything works for our project. It also looks like Amf.perform.ref-writeString-1.10.5.patch is included in ZF 1.11.7 so this bug could be closed?

I am still having horrible performance. What took 200ms on AMFPHP takes 5s on ZendAMF 1.11.7
Thoughts?

Posted by pt (jcrocks) on 2011-06-18T03:07:48.000+0000

X2 on this comment => "I am still having horrible performance. What took 200ms on AMFPHP takes 5s on ZendAMF 1.11.7"

Returning small simple arrays is fine but other than that, very slow. Returning ~200 objects with some properties containing objects takes about 5 seconds. It's not the function that creates the objects either. I capture the micro-time at the beginning of the function and immediately before the return and it's less than half a second. So it takes 4.5 seconds to return the objects to Flex.