Collate JSON terms into array of bytes, preserving sort order of the original
JSON string.
Example input to sort, ignore list.
.gitignore
Transforming json string to byte-sequence preserving sort-order.

collate json
------------

  Collating json normally means comparing two json string to get sort order.
  In our context collating json means tranforming json string into
  byte-sequence preserving the sort order.

Benchmark with dparval
----------------------

The sample json string used for the benchmarks contain about 5 properties
with a mix of bool, float, null and array as property-values.

benchmark for dparval.NewValueFromBytes(json) and doc.Value() APIs
    Benchmark_DParVal         500000              6140 ns/op

and following benchmark is using CollateJSON API from `tugtng`. The benchmark
tries to simulate key comparision while walking through the btree,
    BenchmarkTuqCollate       200000              9959 ns/op

Benchmarks for byte-sequencing json string
------------------------------------------

Encoding json string to byte sequence and comparing:
    BenchmarkEncode   100000             20728 ns/op
    BenchmarkCompare  10000000             157 ns/op

complex part of BechmarkEncode involves encoding integer and float

    Encoding/Decoding integer:
        Benchmark_encodeInt      2000000               975 ns/op
        Benchmark_decodeInt      5000000               640 ns/op

    Encoding/Decoding small-decimal: (-1.0 < number < 1.0)
        Benchmark_encodeSD       2000000               778 ns/op
        Benchmark_decodeSD       5000000               474 ns/op

    Encoding/Decoding large-decimal:
        Benchmark_encodeLD       1000000              2050 ns/op
        Benchmark_decodeLD       1000000              1184 ns/op

I also tried parsing JSON string using parsec (parser combinator) tool, which
ended up being 10-20 times slower when compared with dparval, gojson and
gojson-pointer. May be I am doing it wrong, if some one is interested in
parsec tool, please refer to `parse.go`.

Memory foot print for input and output
--------------------------------------

Ran json encoding on 1 million random json documents,

    average input text size: 97
    average output byte size: 81

Please refer TODO file for known issues.
worked on Dusting Sallings comments,

https://github.com/prataprc/collatejson/commit/d753d1223f20c5c1c7d981f0631d8fb0827267bf

- applied gofmt as well.

Benchmark results, after the modifications

BenchmarkEncodeInt       2000000               897 ns/op
BenchmarkDecodeInt       5000000               607 ns/op
BenchmarkDncodeSD        5000000               742 ns/op
BenchmarkDecodeSD        5000000               434 ns/op
BenchmarkEncodeLD        1000000              2006 ns/op
BenchmarkDecodeLD        1000000              1146 ns/op
BenchmarkEncode           100000             20836 ns/op
BenchmarkCompare        10000000               153 ns/op
BenchmarkDParVal          500000              6414 ns/op
BenchmarkTuqCollate       200000             10333 ns/op
BenchmarkParse             10000            100743 ns/op
Examples and reference out put for collate json.

After fixing couple of bugs.
Updated production monster production file.

Moved examples and reference outputs to example/ directory
Command line program to play for collatejson.

Use command line switch to play with collatejson encoding and decoding.
Program to sort example/* files and compare with reference.
Do monster on collatejson.

Generate large collection of json documents and run regression on collatejson.
Updated TODO list.
Another round of development on collatejson.

- Check for corner cases in function inputs.
- EncodeFloat() and DecodeFloat() APIs are completed and usable.
- Couple of bug fixes.
Updated TODO.
Added integer encoding switch.
NULL termination for json encoding.

- Every basic type encoding is terminated with a NULL byte.
- For arrays, individual array elements are encoded and NULL terminated and
  finally after the last element is encoded, the array itself is NULL
  terminated.
- For properties, property name is encoded and NULL terminated, after which
  the value is encoded and NULL terminated. Finally after all the properties
  are encoded the map itself is NULL terminated.
Changes to API.

- All APIs are now defined as method receiver for Codec reference.
- Codec object contains two configuration, arrayLenPrefix and
  propertyLenPrefix to optionally prefix array type and property type with
  number of elements it contains.
Added a switch to enable/disable length prefix.
Benchmarks and code refactoring.

- Using CollateJSON from tuqtng, instead of using a local version.
- Added granular benchmarks for Floats.
Go format.
Function documentation for codec.