| 1 |
Module `test_json_parser` |
| 2 |
========================= |
| 3 |
|
| 4 |
This module contains two programs for testing the json parsers. |
| 5 |
|
| 6 |
- `test_json_parser_incremental` is for testing the incremental parser, It |
| 7 |
reads in a file and passes it in very small chunks (default is 60 bytes at a |
| 8 |
time) to the incremental parser. It's not meant to be a speed test but to |
| 9 |
test the accuracy of the incremental parser. The option "-c nn" specifies an |
| 10 |
alternative chunk size, "-r nn" runs a range of chunk sizes down to one byte |
| 11 |
on the same input (with output separated by null bytes), and "-s" specifies |
| 12 |
using semantic routines. The semantic routines re-output the json, although |
| 13 |
not in a very pretty form. The required non-option argument is the input file |
| 14 |
name. |
| 15 |
- `test_json_parser_perf` is for speed testing both the standard |
| 16 |
recursive descent parser and the non-recursive incremental |
| 17 |
parser. If given the `-i` flag it uses the non-recursive parser, |
| 18 |
otherwise the standard parser. The remaining flags are the number of |
| 19 |
parsing iterations and the file containing the input. Even when |
| 20 |
using the non-recursive parser, the input is passed to the parser in a |
| 21 |
single chunk. The results are thus comparable to those of the |
| 22 |
standard parser. |
| 23 |
|
| 24 |
The sample input file is a small, sanitized extract from a list of `delicious` |
| 25 |
bookmarks taken some years ago, all wrapped in a single json |
| 26 |
array. |