XH_JSON

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

XH_JSON

Post by cmb » Sun May 11, 2014 3:00 pm

Hello Community,

motivated by a blog post of Nikita Popov about Improving lexing performance in PHP, I had a look at the XH_JSON class which offers fallbacks for json_encode() and json_decode() for PHP < 5.2.

I noticed that the class was not fully covered by unit tests, and that there were some open ToDos. While fixing these issues, I noticed a few bugs regarding \u escape sequences for BOM and UTF-16 surrogate pairs. I have fixed these (r1276).

Anyway, a quick benchmark with tests/unit/data/example.json showed that XH_JSON::decode() is roughly 100 times slower than json_decode() (tested with PHP 5.4.19). I assume that it should be possible to improve the performance of XH_JSON::decode() by factor 5-10 by using the techniques described in Nikita's blog post--OTOH why worry, as we're likely to drop support for PHP < 5.2 rather soon, and most user's won't need XH_JSON anyway.

Any thoughts?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

manu
Posts: 1090
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: XH_JSON

Post by manu » Tue May 13, 2014 1:40 pm

+1. Just wait, and time will solve the problem.

Post Reply