NOW we're really getting to the part where this module is more awesome
than DBD::Pg.
(When I started working on this module I was expecting that the Postgres
binary protocol would send jsonb in a binary format as well and that I'd
be duplicating parts of the JSON parser/formatter to make that work, but
it turns out that Postgres just uses plain json for exchange. Saves me
some trouble, I guess)
That completes the json_format() function for now. At least, it now does
everything I had planned for it.
Ended up at a bit over 300 LOC. That's larger than I had expected, but
still alright.
Going to need a way to pass arguments into the XS function anyway, so
might as well do the entire arg parsing step in XS while we're at it.
Provides a significant speedup for tiny inputs as well, but I don't find
that too interesting.
It works and can format all "plain" Perl data, but has a few known bugs
and limitations that still need to be worked out.
It's about 8x smaller than JSON::XS's encoder and *much* smaller than
Cpanel::JSON::XS, but this is just a first attempt, it'll grow.