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
XH_JSON
XH_JSON
Christoph M. Becker – Plugins for CMSimple_XH
Re: XH_JSON
+1. Just wait, and time will solve the problem.