Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73412 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3590 invoked from network); 25 Mar 2014 07:47:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Mar 2014 07:47:39 -0000 Authentication-Results: pb1.pair.com header.from=jan@horde.org; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=jan@horde.org; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain horde.org does not designate 82.98.68.218 as permitted sender) X-PHP-List-Original-Sender: jan@horde.org X-Host-Fingerprint: 82.98.68.218 fra.ammma.de Linux 2.6 Received: from [82.98.68.218] ([82.98.68.218:51002] helo=fra.ammma.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/11-28634-89431335 for ; Tue, 25 Mar 2014 02:47:38 -0500 Received: from ammma.de (fra2-hb [192.168.1.12]) by fra.ammma.de (Postfix) with ESMTPS id 289585B04CD for ; Tue, 25 Mar 2014 08:47:34 +0100 (CET) Received: from mail.ammma.net (ns.ammma.mil [192.168.110.1]) by ammma.de (8.11.6/8.11.6/AMMMa AG) with ESMTP id s2P79QB17012 for ; Tue, 25 Mar 2014 08:09:26 +0100 Received: from neo.wg.de (hydra.ammma.mil [192.168.110.1]) by mail.ammma.net (Postfix) with ESMTP id A78434D1C078 for ; Tue, 25 Mar 2014 08:47:33 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by neo.wg.de (Postfix) with ESMTP id 52FD5DC24E1 for ; Tue, 25 Mar 2014 08:47:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at wg.de Received: from neo.wg.de ([127.0.0.1]) by localhost (neo.wg.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ojWeZWU85u5T for ; Tue, 25 Mar 2014 08:47:09 +0100 (CET) Received: from neo (localhost [127.0.0.1]) by neo.wg.de (Postfix) with ESMTPS id 2B64FDC2182 for ; Tue, 25 Mar 2014 08:47:09 +0100 (CET) Received: from 192.168.60.175 ([192.168.60.175]) by neo.wg.de (Horde Framework) with HTTP; Tue, 25 Mar 2014 08:47:09 +0100 Date: Tue, 25 Mar 2014 08:47:09 +0100 Message-ID: <20140325084709.Horde.8NjJCNsOIKnYtdK5Cz1Mfg2@neo.wg.de> To: internals@lists.php.net References: In-Reply-To: User-Agent: Internet Messaging Program (IMP) H5 (6.2.0-git) Content-Type: text/plain; charset=UTF-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [PHP-DEV] New JSON parser From: jan@horde.org (Jan Schneider) Zitat von Jakub Zelenka : > 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 Can you explain what exactly the following means in your documentation: "If the extension is compiled with defined macro PHP_JSOND_PRIMARY", or how to actually accomplish this? Maybe even for PECL builds? Thanks. -- Jan Schneider The Horde Project http://www.horde.org/ https://www.facebook.com/hordeproject