Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84091 invoked from network); 7 Apr 2012 12:23:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2012 12:23:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:42515] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/15-57786-4A1308F4 for ; Sat, 07 Apr 2012 08:23:01 -0400 Received: by yenl5 with SMTP id l5so1689181yen.29 for ; Sat, 07 Apr 2012 05:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=cQKlvtQl/3ITfU8LT/Pd9P5+7gIto1T9mj2pZnbF1TM=; b=CrORJkQTWPi046BMjrhRXnLFA+RggVa8AfBxKTelof6HSvwCB06atCJLJBwIEAbXeA Pish7XkTPrR3QONJTaJD7H7Ffvc8mz3TI7Z/WiqxsgRXqwMp4KLllUcYquRtQETAGGUT dFkaefI0G3PG714rKHcnViwEXa83EGytAJ37Sky8LHnjotp1Yw7xW7/7z9Ex5ccuEA11 EySbFGnVUFwD9MZ1Q8ZyfQxmDYDayMxZB29El5HLTKV2HCQPGDQzSV7XG1GqwRxfSAeA UUnJRBgkiKRWw365xfqf2GoRJjerEaX4OUs9SvrtdnAaeJBjGSL8mW/7Hn5HtFsMkk+I Wldg== MIME-Version: 1.0 Received: by 10.101.7.27 with SMTP id k27mr294292ani.18.1333801377852; Sat, 07 Apr 2012 05:22:57 -0700 (PDT) Received: by 10.147.168.16 with HTTP; Sat, 7 Apr 2012 05:22:57 -0700 (PDT) In-Reply-To: <7714055974799768995@unknownmsgid> References: <2082600.13123.1333758215113.JavaMail.mobile-sync@iaje9> <7714055974799768995@unknownmsgid> Date: Sat, 7 Apr 2012 14:22:57 +0200 Message-ID: To: Luke Scott Cc: =?ISO-8859-1?Q?Johannes_Schl=FCter?= , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Persistent zvals From: pierre.php@gmail.com (Pierre Joye) hi, 2012/4/7 Luke Scott : > 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