Re: [Fwd: Re: [PEAR-DEV] Re: unserialize() bottle-neck]
| From: | Olivier Guilyardi | Date: | Sun, 16 Jan 2005 22:12:10 +0000 |
| Subject: | Re: [Fwd: Re: [PEAR-DEV] Re: unserialize() bottle-neck] | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-35521@lists.php.net to get a copy of this message | ||
Louis Mullie wrote:
Lukas Smith wrote:In my case, it's just an array, not an object. But I don't get why serializing an object with private properties could cause trouble. Can't you just write a MyClass::serialize() method that serializes $this and returns the resulting string ? -- ogOlivier Guilyardi wrote:PHP5's protected/private identifiers make it very difficult to serialize an object with such properties. Using a few hacks, I was able to write successfully a simple serializer, but it was still slower than the PHP's serialize() function. Here are the results of a basic benchmark I did : Using custom serializer : serialize/unserialize time 0.000229120254517 secs Using built-in serializer : serialize/unserialize time 0.000040054321289 secsHave you ever encountered such optimization problems with serialize()/unserialize() ? I quite understand that unserializing a 150ko string (the index) into an array take some time, but how to optimize that ?I remember Wez once saying that he either wrote a faster serialize() or unserialize() in PHP itself ..