Server IP : 92.204.138.22 / Your IP : 3.145.103.105 Web Server : Apache System : Linux ns1009439.ip-92-204-138.us 4.18.0-553.8.1.el8_10.x86_64 #1 SMP Tue Jul 2 07:26:33 EDT 2024 x86_64 User : internationaljou ( 1019) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/var/opt/nydus/ops/jsonschema/benchmarks/ |
Upload File : |
""" An unused schema registry should not cause slower validation. "Unused" here means one where no reference resolution is occurring anyhow. See https://github.com/python-jsonschema/jsonschema/issues/1088. """ from pyperf import Runner from referencing import Registry from referencing.jsonschema import DRAFT201909 from jsonschema import Draft201909Validator registry = Registry().with_resource( "urn:example:foo", DRAFT201909.create_resource({}), ) schema = {"$ref": "https://json-schema.org/draft/2019-09/schema"} instance = {"maxLength": 4} no_registry = Draft201909Validator(schema) with_useless_registry = Draft201909Validator(schema, registry=registry) if __name__ == "__main__": runner = Runner() runner.bench_func( "no registry", lambda: no_registry.is_valid(instance), ) runner.bench_func( "useless registry", lambda: with_useless_registry.is_valid(instance), )