From 0b041ed8b0fc1d5c4877ca3c3f3e06a68e2d0eaf Mon Sep 17 00:00:00 2001 From: poiuty Date: Mon, 17 Aug 2020 15:43:33 +0300 Subject: [PATCH] add orjson --- electrumx/lib/util.py | 9 +++++++-- setup.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/electrumx/lib/util.py b/electrumx/lib/util.py index 82a7daf58..0c0e123cd 100644 --- a/electrumx/lib/util.py +++ b/electrumx/lib/util.py @@ -41,9 +41,14 @@ import rapidjson as json except ImportError: try: - import ujson as json + import orjson as json except ImportError: - import json + try: + import ujson as json + except ImportError: + import json + +print("using", json.__name__) json_deserialize = json.loads json_serialize = json.dumps diff --git a/setup.py b/setup.py index 0668e9e53..c5e3c17cf 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ 'rapidjson': ['python-rapidjson>=0.4.1,<1.0.0'], 'rocksdb': ['python-rocksdb>=0.6.9'], 'ujson': ['ujson>=2.0.0,<4.0.0'], + 'orjson': ['orjson>=3.2.2'], 'uvloop': ['uvloop>=0.14'], # For various coins 'blake256': ['blake256>=0.1.1'],