Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73165 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88348 invoked from network); 14 Mar 2014 15:38:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2014 15:38:27 -0000 Authentication-Results: pb1.pair.com header.from=dragoonis@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dragoonis@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.175 as permitted sender) X-PHP-List-Original-Sender: dragoonis@gmail.com X-Host-Fingerprint: 209.85.216.175 mail-qc0-f175.google.com Received: from [209.85.216.175] ([209.85.216.175:52689] helo=mail-qc0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/71-11488-27223235 for ; Fri, 14 Mar 2014 10:38:27 -0500 Received: by mail-qc0-f175.google.com with SMTP id e16so3017721qcx.6 for ; Fri, 14 Mar 2014 08:38:23 -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=NwE9f3+IkpoRTPMjVAlqsXFZlr29Vx7XdNBHVNErOMc=; b=AP/oZ6o0xRtmAVde03JMZSYR5rZm4xds8QBOCdCJf2qhQSmmmkI4eXG190nimg1BMi E4Po++hjEe2IQyVNommET45wmsLGB+s/u3Ve+ijDJfI0jYUc1veZQDKVRacK6NCytYdi MGdW70yP/LCIEHHio3KDMnFbSGRKKqOHBlY8lxBkTD+T7/OmvkjRVlY19FErL6DqmZqO gdYDQs6LalpsupHP+2HN0XYrhGl9uEc+h6xzBH6u0vQ6rNwNchmG5+GUYvmNbZYHsWEO Oq7TWUbGe/LYEMKePybndWU2ZaJECeW3Kq7ZL8TdUInkWldABqUmfY3S5Tp1gtyU0xGQ vnvQ== MIME-Version: 1.0 X-Received: by 10.224.22.65 with SMTP id m1mr2441783qab.103.1394811503855; Fri, 14 Mar 2014 08:38:23 -0700 (PDT) Received: by 10.229.153.199 with HTTP; Fri, 14 Mar 2014 08:38:23 -0700 (PDT) In-Reply-To: References: Date: Fri, 14 Mar 2014 15:38:23 +0000 Message-ID: To: Jakub Zelenka Cc: PHP internals list Content-Type: multipart/alternative; boundary=047d7bdca37637502f04f492dce7 Subject: Re: [PHP-DEV] New JSON parser From: dragoonis@gmail.com (Paul Dragoonis) --047d7bdca37637502f04f492dce7 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Mar 13, 2014 at 7:48 PM, Jakub Zelenka wrote: > Hi, > > I have create a new JSON parser using conditional re2c and pure pull Bison > parser. It's a native UTF-8 parser licensed under PHP license (it can be > used for Evil though :) ). The extension is available at > > https://github.com/bukka/php-jsond > > The encoder is taken from the current ext/json but the decoder has been > completely rewritten. > > I have done some basic benchmarks (the results are on the README.md page). > For short strings the results are almost the same (the new parser is > usually slightly faster) but there is a big difference for longer strings. > For example for string with 800 characters the new parser is 4 times > faster. If the string is longer, the results are even better. It's also > much faster for big arrays. For example decoding json_encode($_SERVER) is > twice faster with the new parser. > > In addition to the speed improvements there also is a big memory saving. > The old parser converts every serialized string to UTF-16 which requires > additional memory. Although the memory is freed after the parsing, it can > be problematic if the memory_limit is set. The new parser parses supplied > string and no extra memory for conversion is allocated. > > I need to do more testing before creating RFC for replacing the current > parser. There is still space for further improvements. If anyone has any > ideas, please let me know. Or if you could test it, that would be great > too! ;) > > I haven't finished the build config (it's working but it's not auto rebuild > when you change *.y or *.re files). Need to figure out how to add > Makefile.frag for bison and re2c . It's not working when I add > PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag) > $ make > make: *** No rule to make target `jsond.lo', needed by `jsond.la'. Stop. > Has anyone got any idea? :) > Also there is no build for Win atm as I don't have Windows... :( Hopefully > someone will do it for me... :) > > Thanks > > Jakub > Thanks very much for taking the time to put together php-jsond, I also think supporting the new ES5 proposal is a no-go and stick to what we have now. Essentially I see php-jsond being a drop-in replacement for the existing implementation of the json_* functions. --047d7bdca37637502f04f492dce7--