derek-schaefer / django-json-field

Generic JSON model and form fields.
BSD 3-Clause "New" or "Revised" License
122 stars 86 forks source link

Decoding/encoding time/date/datetime should be optional, if not disabled by default. #17

Closed fletom closed 11 years ago

fletom commented 11 years ago

That feature, while interesting, isn't necessary for most applications.

It's also, by my admittedly inexact measurement, over three times slower:

In [25]: %timeit json.loads(s)
10000 loops, best of 3: 30.8 us per loop

In [26]: %timeit json.loads(s, cls = JSONDecoder)
10000 loops, best of 3: 100 us per loop
derek-schaefer commented 11 years ago

Yes it's definitely slower, I get similar results. However, there is a way to disable the custom deserializer:

json = JSONField(decoder=None)

Regarding disabling it by default, I'm not sure about that yet. Most importantly it would break backwards compatibility, so I'm going to leave it as is for now.