talentdeficit/jsx — pull request #7 by fogfish (2012-03-22 19:41:44+00:00)
Title: to_json performance fix

The json_escape algorithm used in you version causes a lot of binary data copy. As the consequence, it is almost 5 times slower to convert erlang term into json, if I would compare it with mochiweb.

to_json
* jsx: 5203 ms, 0.520 ms per object
* mochi: 1511ms, 0.151 ms per object

the proposed fix reduces the time twice

to_json
* jsx 2157ms, 0.217 ms per object
* mochi 1495ms, 0.150 ms per object

in addition to that, priv/b/jsx_b.erl is a benchmark test is supplied.