Drop json in favor of orjson?
mkrd opened this issue · 3 comments
Orjson is so much faster that it is the better choice in all cases
Pro:
- Faster
- Simpler code
Cons:
- Orjson only allows indenting files with two spaces, or no indentation at all when writing
- Only allows strings as keys. Can be changed but performance should be tested
Personally, I made a decision with https://github.com/adamghill/django-unicorn to require orjson
because supporting both orjson
and json
(or another library) would have been too complicated and hard to test. I did get some users with issues a few years ago because it was Rust, but that hasn't happened in a long time.
Unless you have users who really don't want to use orjson
for some reason it seems reasonable to me to just require orjson
.
Currently I am running all tests on all possible configs, so thats not the issue. But yeah, I also don't see how anyone would definitely need the regular json module, except for that orjson only allows to indent with 2 spaces as opposed to json which allows more options, and the fact that json handles non-string keys by default
Since the code that allows to also use json is very simple and tested, json will be supported for the future because it allows more indentation options and non-str keys