Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69970 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68307 invoked from network); 30 Oct 2013 21:37:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2013 21:37:07 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.47 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.128.47 mail-qe0-f47.google.com Received: from [209.85.128.47] ([209.85.128.47:65027] helo=mail-qe0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/20-00845-20C71725 for ; Wed, 30 Oct 2013 16:37:06 -0500 Received: by mail-qe0-f47.google.com with SMTP id b4so1225266qen.20 for ; Wed, 30 Oct 2013 14:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=7ajpzqMzoIG7vvv+AykhKjOK3pxhe4WD0/b4DBK3b5k=; b=SB1twxFgSql7pP61dmI21Yw+p0TI62clWWPxSj4CLFTYxlLkinvlF2aUWAyrC+IIlS KU8lXtaROTp/Wk+RrJHpk+TtLzOGQIqjI52n4KBq50Eo5c9IxLQ7rsop6TGarH8++4FC lXDGCl3vS35/JrEUkG8q43EQewlGdFV6KoE8tzoJmfvLZM2n9me9qQAh8uAd7k5tB0Rk WcsUrCkH8WcJQBUB8xXHs5d/GIVmABkn7m4Lu6nh8Vijug+azspf1e5EGWUO5IoCDNLc wUEAafY78Uc9cInIv/226gP6zjqDRsB2yaQDR/1x2+uKzhdWZxO19pGc3RFkEaXRxRqI 0HeQ== MIME-Version: 1.0 X-Received: by 10.49.0.208 with SMTP id 16mr9781572qeg.25.1383169023058; Wed, 30 Oct 2013 14:37:03 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.224.37.133 with HTTP; Wed, 30 Oct 2013 14:37:02 -0700 (PDT) Date: Wed, 30 Oct 2013 21:37:02 +0000 X-Google-Sender-Auth: 89juMQVU6Eb4nxQdzksC3nsKNfg Message-ID: To: "nikic@php.net" , PHP internals list Content-Type: multipart/alternative; boundary=047d7b33d17448b8da04e9fc2214 Subject: GMP serialization From: bukka@php.net (Jakub Zelenka) --047d7b33d17448b8da04e9fc2214 Content-Type: text/plain; charset=ISO-8859-1 Hi, There is a new patch that is changing serialization in GMP: http://git.php.net/?p=php-src.git;a=commitdiff;h=4218e89f8df4ca3897e3aad595e0c2c9cf4c3aca It fixes the bug but it also introduces BC break for serialized string (custom serialization replaced the std object serialization). The problem is that there can be users (one big user is WordPress) that saves the serialized into DB which can lead to the difficulties when updating PHP version. I think that the new serialized API that I proposed some time ago ( https://wiki.php.net/rfc/internal_serialize_api ) could solve the problem. I actually just wrote a patch that fixes the same bug and uses a new serialize API: https://github.com/bukka/php-src/commit/d3c04d001f3a86409d45a0f268ea4945fa53489b I also created few benchmarks: == BEFORE THE FIX == O:3:"GMP":1:{s:3:"num";s:2:"42";} SERIALIZATION: time for 100000 iterations: 0.230430 UNSERIALIZATION: time for 100000 iterations: 0.469807 == AFTER THE FIX == C:3:"GMP":15:{s:2:"42";a:0:{}} SERIALIZATION: time for 100000 iterations: 0.319425 UNSERIALIZATION: time for 100000 iterations: 0.354855 == AFTER MY PATCH (new serialization API) == O:3:"GMP":1:{s:3:"num";s:2:"42";} SERIALIZATION: time for 100000 iterations: 0.195529 UNSERIALIZATION: time for 100000 iterations: 0.241552 As you can see after using a new serialization API, the performance has improved and mainly the serialized string is the same as the one before the fix. If anyone is interested: I also have an initial patch for DateTime (still need to do quite a few things so it's incomplete but it works fine for DateTime): https://github.com/bukka/php-src/compare/date_using_serialize_api#files_bucket I think that the API patch is ready https://github.com/bukka/php-src/compare/serialize_internal_api . There are few extension that could profit from it so I think that it could be a useful addition... Any thoughts? Thanks for reading this long and boring email... :) Regards Jakub --047d7b33d17448b8da04e9fc2214--