Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68669 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78399 invoked from network); 29 Aug 2013 07:31:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2013 07:31:31 -0000 Authentication-Results: pb1.pair.com header.from=remi@fedoraproject.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=remi@fedoraproject.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fedoraproject.org from 212.27.42.3 cause and error) X-PHP-List-Original-Sender: remi@fedoraproject.org X-Host-Fingerprint: 212.27.42.3 smtp3-g21.free.fr Linux 2.6 Received: from [212.27.42.3] ([212.27.42.3:52735] helo=smtp3-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/34-57841-0D8FE125 for ; Thu, 29 Aug 2013 03:31:31 -0400 Received: from schrodingerscat.famillecollet.com (unknown [82.241.130.121]) by smtp3-g21.free.fr (Postfix) with ESMTP id 9C3BDA62D0 for ; Thu, 29 Aug 2013 09:31:21 +0200 (CEST) Message-ID: <521EF8C8.4000905@fedoraproject.org> Date: Thu, 29 Aug 2013 09:31:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130806 Thunderbird/17.0.8 MIME-Version: 1.0 To: PHP Internals References: <521EE223.9060702@fedoraproject.org> <521EE964.4080506@sugarcrm.com> <521EED19.4060500@fedoraproject.org> <521EF286.8070008@sugarcrm.com> In-Reply-To: <521EF286.8070008@sugarcrm.com> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Switch from json extension to jsonc [Discussion] From: remi@fedoraproject.org (Remi Collet) Le 29/08/2013 09:04, Stas Malyshev a écrit : > Hi! > >> From my analysis (profiling), most of the time is spent in memory >> allocation calls. >> >> As we used a parser from a library, we do >> 1- parse in library space >> 2- object tree allocation of the result >> 3- copy result from library space to php space >> 4- PHP object tree allocation > > Can't we just patch the lib to do the right thing? Is it just malloc vs. > emalloc or deeper problems? Probably deeper problem. Moving to statically allocated stack (just a stupid test, of course) of json_object only reduce time by ~15%... > >> I don't see any good solution to optimize this except copying the code >> from the library into PHP, and thus remove stop 2+3. > >> Of course I have tried to avoid this (copying the code) and prefer to >> keep the library unchanged... but... > > Well, 2x slowdown is pretty serious. I didn't have a good look at the > code so I can't advise how to fix it, but I think it needs to be fixed > one way or another. >