Enhance the performance of the recursive descent JSON parser,
mainly the jsonParse() function.
1. The old version would create a jsonObject and then copy it, with
possible modifications, via a call to jsonObjectDecodeClass(), in
order to decode class hints into the classname member. Finally, it
would throw away the original jsonObject.
The copying operation is expensive, and the new version eliminates
it. When decoding is desired (which is nearly always), execution
passes through a parallel version of the get_hash() function, which
does the decoding on the fly.
In my benchmarking, the new version reduces the parsing time by
around 35 - 45 percent. It is now at least twice as fast as the
older jsonParseString() function, which uses a finite state
machine instead of recursive descent.
2. In get_number(): instead of allocating and destroying a
temporary growing_buffer, use the one available in the
Parser structure.
3. In osrf_json.h: Applied some pedantic corrections to the
doxygen comments for the old parser.
--------
In all cases tested, the new version produces results identical
to those of the old version. The results are also identical to
those of the older parser, apart from error detection.
M include/opensrf/osrf_json.h
M src/libopensrf/osrf_parse_json.c
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1804
9efc2488-bf62-4759-914b-
345cdb29e865