Comments By: Mike Ritchie
-
Hi Peter, I'm glad to hear that with the magic functions and arrayaccess I can allow people to use $object['property'] or $object->property as they so choose. I'm the lead (and pretty much only) developer for the PHP port of the popular Fusebox framework, originally developed for ColdFusion. Before anyone starts to scoff and snort saying how bad ColdFusion is or how bad Fusebox is, I will say that that it's becoming very popular in PHP as well, and I've received a great deal of support from other developers who have used the framework for their applications' success. My problem comes in the fact that the new version of the framework has moved to objects. CF has an application scope that persists across requests even from multiple users, so once the XML config and command files are read in and converted into the stored object it takes milliseconds for subsequent requests to access them. Previously I replicated the "application" scope by writing the complex structure to disk using var_export(). Even though the resultant file could be 800k or higher for larger projects, the structure file could be included into the beginning of the request with only a small performance hit. Now that the cached structure contains instantiated objects I can no longer use that technique and am forced to use serialize/deserialize. Now, though the physical file is actually smaller, it takes up to 10 times longer for a large application structure to become ready for the rest of the request. Even though the new version of the framework is far superior to the previous, this overhead -- along with the fact that the array notation in their user code no longer works for accessing child members -- is causing many PHP Fusebox developers to stick with the previous version. Sorry to take this off-topic. I'll happily move this to a private discussion if you wish to contact me at mike [at] fusebuilder [dot] netposted on Aug 22, 2007 at 11:27am | context
-
These are definitely great pointers. One question about the SPL functions you refer to, if you were to construct an object to support them does that mean that the normal method of passing attributes into an instantiated object through arguments won't work anymore? Is it one or the other, or can you use either $foo->bar or $foo['bar']? Another thing that I'm interested in but have not been able to find anything about, is how to store an instantiated object to disk without having the overhead of serialize and deserialize? I have upgraded some framework code from a large associative array to an object with methods and properties. I used to store the array to disk by using var_export() which took a third of the time that serialize/deserialize takes to load. Is there something comparable for instantiated objects?posted on Aug 20, 2007 at 1:16am | context