1
0
Fork 0
mirror of https://github.com/ultrajson/ultrajson.git synced 2024-05-25 02:46:21 +02:00
This commit is contained in:
joncrall 2022-05-29 19:08:43 -04:00
commit 10ed58b708
No known key found for this signature in database
GPG Key ID: BE04D092BDD81C0D
4 changed files with 13 additions and 6 deletions

View File

@ -28,6 +28,7 @@ class AnalysisConfig(scfg.Config):
def analyze_results(result_fpaths):
import json
from json_benchmarks import benchmarker
from json_benchmarks.benchmarker import util_stats

View File

@ -65,7 +65,7 @@ def main(cmdline=True, **kwargs):
"""
config = CoreConfig(cmdline=cmdline, data=kwargs)
dpath = config["cache_dir"]
print(f'dpath={dpath}')
print(f"dpath={dpath}")
run = config["mode"] in {"all", "single", "run"}
if run:

View File

@ -38,20 +38,24 @@ class Compatability:
@staticmethod
def lut_dumps(module):
if module.__name__ == 'cysimdjson':
if module.__name__ == "cysimdjson":
return None
<<<<<<< HEAD
elif module.__name__ == 'simdjson':
=======
elif module.__name__ == "pysimdjson":
>>>>>>> 7dbb203450810217c6f8790c01fb54d73d5305b7
return None
else:
return getattr(module, 'dumps', None)
return getattr(module, "dumps", None)
@staticmethod
def lut_loads(module):
if module.__name__ == 'cysimdjson':
if module.__name__ == "cysimdjson":
parser = module.JSONParser()
return parser.loads
else:
return getattr(module, 'loads', None)
return getattr(module, "loads", None)
def available_json_impls():
@ -64,7 +68,9 @@ def available_json_impls():
>>> print('json_impls = {}'.format(ub.repr2(json_impls, nl=1)))
"""
import importlib
import pkg_resources
known_libinfo = KNOWN_LIBRARIES
json_impls = {}
for libinfo in known_libinfo:

View File

@ -125,7 +125,7 @@ def benchmark_json():
# Put the logic you want to time here
method(data)
except Exception as ex:
print(f'Failed to time: ex={ex}. Skipping')
print(f"Failed to time: ex={ex}. Skipping")
dpath = ub.Path.appdir("ujson/benchmark_results").ensuredir()
result_fpath = benchmark.dump_in_dpath(dpath)