Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77534 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12430 invoked from network); 23 Sep 2014 13:57:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2014 13:57:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.181 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.181 mail-wi0-f181.google.com Received: from [209.85.212.181] ([209.85.212.181:34268] helo=mail-wi0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/02-01186-43C71245 for ; Tue, 23 Sep 2014 09:57:09 -0400 Received: by mail-wi0-f181.google.com with SMTP id z2so5127572wiv.8 for ; Tue, 23 Sep 2014 06:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=qLtjBs/mEEkNk1Bld24euySKrKodOrWyHKTgvZGo6rQ=; b=dg0wNZrhbd1Bg8aJIjYAL3LdN+ur0jQncerojm9GTTpE14WFNZFEX36mA5wuV/LbeJ xrH29h9vqlKDYIJS6bzQhUsiPusPaFoYdB+p9mKaNa69mrI0k96Of/KfG734LIr0cK3u kWNYt9XRJAqdDoasZKbeFl07LNz5zs6ES8nHZMzdFnAsJgvTbu3ZmH9EDIMIFtUNnjQL A0gVJU/w1GyunNbeqqZ9XHh8M5U41i1tvvPUX53b3sWocQWc06I2uhd3ZLiV8g72f1RN wk5W/PFfaGQ7z9cm0A472WcIlGxlNdjtsnG1AD9Z4B/8gIzbVFhIhELbL/kzoxRbHA9/ 0OuA== X-Received: by 10.194.78.170 with SMTP id c10mr28794918wjx.22.1411480625643; Tue, 23 Sep 2014 06:57:05 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id u10sm2406982wix.2.2014.09.23.06.57.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 06:57:04 -0700 (PDT) Message-ID: <54217C2D.1070700@gmail.com> Date: Tue, 23 Sep 2014 14:57:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Improve PHP 7 serialization From: rowan.collins@gmail.com (Rowan Collins) Park Framework wrote (on 23/09/2014): > PHP serialization is slowest in PHP Session, clients NoSQL, ... > I would like to have in PHP 7, a new serialization algorithm or custom > handler to serialize. > > My opinion is that the best choice is to use msgpack, it is > +110% faster > -30% data size > > HHVM discussed this issue, but all boils down to backward compatibility with PHP > https://github.com/facebook/hhvm/issues/2654 > > What do you think about this, maybe it's time to change the old > algorithm serialization, on something better? > Apart from the BC implications, using a binary serialization by default might cause issues with anyone who is storing or passing the serialized data somewhere which is not binary-safe. Admittedly, any object with private properties generates a serialized form with null bytes, but many values will consist entirely of ASCII characters, and some code may rely on this being the case. The format is also widely known, and has been implemented in other languages for compatibility (although it is **not** suitable for untrusted data exchange, as Anthony Ferrara tweeted a few months ago: https://twitter.com/ircmaxell/status/452182852562862080) We already have pluggable serializers for sessions (needed because the serialization happens implicitly in the session handling code), and can add as many functions for types of serialization as seem sensible, so I'm not sure what the benefit of changing serialize()/unserialize() themselves is. Changing the default *session* serialization might be worth considering, though, along with bundling something like igbinary or msgpack. Oh, and a non-batshit version of session_decode() for manually invoking session (un)serialization handlers :P -- Rowan Collins [IMSoP]