> There might be tin cans and string involved too. Immutable string?
On Mon, Oct 8, 2012 at 4:49 PM, Jens Alfke <[email protected]> wrote: > > On Oct 8, 2012, at 1:14 PM, Mark Hahn <[email protected]> wrote: > > > I've always just felt more comfortable having them stored as dates to > > begin with so there's no additional conversion process to extract those > > year, month, etc values. > > For that matter it might be slower to > > convert from the JSON number in a string to a Date than from a string to > a > > Date. I have no idea of course. > > I don’t know how SpiderMonkey does it, but dates are very often > represented internally as timestamps*, so the conversion from a number > would be very cheap. Whereas accessing the month/date/etc. would involve > first parsing the date string to a numeric timestamp, then processing that > timestamp to re-derive those fields. > > > I wonder if Couch stores the JSON as a > > string in the DB or converted to binary. > > I believe CouchDB stores documents internally as serialized Erlang terms. > I don’t know much about this format other than that it’s binary not ASCII. > On the other hand, the docs have to be converted to JSON to be sent across > the wire to the view server, and then parsed into JavaScript objects. There > might be tin cans and string involved too. :p > > —Jens > >
