* Merlin Moncure (mmonc...@gmail.com) wrote: > On Tue, Apr 26, 2016 at 11:49 AM, Stephen Frost <sfr...@snowman.net> wrote: > > As I mentioned to Sehrope on IRC, at least for my 2c, if you want a > > compact JSON format to reduce the amount of traffic over the wire or to > > do things with on the client side, we should probably come up with a > > binary format, rather than just hack out the whitespace. It's not like > > representing numbers using ASCII characters is terribly efficient > > either. > > -1 > > This will benefit pretty much nobody unless you are writing a hand > crafted C application that consumes and processes the data directly.
That's not accurate. All that's needed is for the libraries which either wrap libpq or re-implement it to be updated to understand the format and then convert the data into whatever structure makes sense for the language (or library that the language includes for working with JSON data). One of the unfortunate realities with JSON is that there isn't a terribly good binary representation, afaik. As I understand it, BSON doesn't support all the JSON structures that we do; if it did, I'd suggest we provide a way to convert our structure into BSON. > I'd venture to guess this is a tiny fraction of pg users these days. > I do not understand at all the objection to removing whitespace. > Extra whitespace does nothing but pad the document as humans will > always run the document through a prettifier tuned to their specific > requirements (generally starting with, intelligent placement of > newlines) if reading directly. The objection is that it's a terribly poor solution as it simply makes things ugly for a pretty small amount of improvement. Looking at it from the perspective of just "whitespace is bad!" it might look like a good answer to just remove whitespace, but we should be looking at it from the perspective of "how do we make this more efficient?". Under that lense, removing whitespace appears to be minimally effective whereas passing the data back in a binary structure looks likely to greatly improve the efficiency on a number of levels. > Also, binary formats are not always smaller than text formats. While true, I don't think that would be true in this case. Of course, there's nothing like actually trying it and seeing. Thanks! Stephen
signature.asc
Description: Digital signature