Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73147 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43787 invoked from network); 14 Mar 2014 08:48:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2014 08:48:19 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.54 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.160.54 mail-pb0-f54.google.com Received: from [209.85.160.54] ([209.85.160.54:53498] helo=mail-pb0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/F0-47923-252C2235 for ; Fri, 14 Mar 2014 03:48:19 -0500 Received: by mail-pb0-f54.google.com with SMTP id ma3so2309236pbc.41 for ; Fri, 14 Mar 2014 01:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=s7zK17lrTFuBa6Tec2jy81UT5bCg57wDU89xYtlpDFY=; b=EFey9GNho39obJ/jd98k6+Zl53lELX+DWu5XwO0itckz5AeYmQKzcJgqEEjghdC1J/ WMev0I8ANHXoOSMmEdNy9kgsLyFvYcncbDbd8pwsYqZunb52up7RrG0axzA2Uw82sXCi +H9HbgT+SzkoD7KLSi76rRr3+Rc7VWdJ46g4ExMo6WGxcyx2QHpQJHEsDdru/1kphKrK mxe/O1FOwiYnMoJT4IHVZJjPzZjuoGtkDjvg09AsSxRa2yl/sxX8bGpoft1hFG0SbpVO ER2xtkcnsxq/pDz9kwq2D9TWr/vjFfIDWYLTboh0g/shyMgTic85miq21eLp4CBiyA/k yxTw== X-Received: by 10.67.24.1 with SMTP id ie1mr7613576pad.133.1394786896555; Fri, 14 Mar 2014 01:48:16 -0700 (PDT) Received: from [10.250.81.109] ([106.120.255.230]) by mx.google.com with ESMTPSA id i10sm22463543pat.36.2014.03.14.01.48.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 01:48:14 -0700 (PDT) References: Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable Message-ID: Cc: PHP internals list X-Mailer: iPhone Mail (11D167) Date: Fri, 14 Mar 2014 16:48:07 +0800 To: Jakub Zelenka Subject: Re: [PHP-DEV] New JSON parser From: laruence@gmail.com (Gmail) really great=A3=A1=20 thanks for the work=A3=A1 Sent from my iPhone > On Mar 14, 2014, at 3:48 AM, Jakub Zelenka wrote: >=20 > Hi, >=20 > 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 >=20 > https://github.com/bukka/php-jsond >=20 > The encoder is taken from the current ext/json but the decoder has been > completely rewritten. >=20 > 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. >=20 > 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. >=20 > 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! ;) >=20 > I haven't finished the build config (it's working but it's not auto rebuil= d > 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... :) >=20 > Thanks >=20 > Jakub