hi,

2012/4/7 Luke Scott <l...@cywh.com>:

> It would be ideal of you could initialize a bunch of objects once and
> carry them over to the next request. No serialization, no copying. A
> lot of framework objects would benefit from this.

The expensive parts here are not the object creation on its own but to
get the data they contain (external, calculation, etc.).

That's why we have magic methods like __sleep and __wakeup. Making
objects or values persistent across requests is not possible or very
hard. It is way cleaner to create them on each request and save the
expensive computation or data fetching time (see doctrine for example)
instead of trying to figure out tricks to get rid of the references
and all other ways to mess  up a zval between requests.

The serialization method can be optimized easily, igbinary for example
can help to speed up this process.

It is also important to keep in mind that PHP is not designed to have
persitant user land values and won't be. There are very good tools to
store these data, like memcached, couchbase, redis and co for the
distributed ones, apc and other for local caches (even like mysqlnd_cc
for caching mysql results :).

Cheers,
-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to