diff options
-rw-r--r-- | jsonschema/benchmarks/validator_creation.py | 14 | ||||
-rw-r--r-- | tox.ini | 16 |
2 files changed, 24 insertions, 6 deletions
diff --git a/jsonschema/benchmarks/validator_creation.py b/jsonschema/benchmarks/validator_creation.py new file mode 100644 index 0000000..da5bac2 --- /dev/null +++ b/jsonschema/benchmarks/validator_creation.py @@ -0,0 +1,14 @@ +from pyperf import Runner + +from jsonschema import Draft202012Validator + +schema = { + "type": "array", + "minLength": 1, + "maxLength": 1, + "items": {"type": "integer"} +} + + +if __name__ == "__main__": + Runner().bench_func("validator creation", Draft202012Validator, schema) @@ -14,6 +14,9 @@ skipsdist = True changedir = {envtmpdir} passenv = CI, GITHUB_STEP_SUMMARY, PYTHONUTF8 setenv = + PIP_DISABLE_PIP_VERSION_CHECK = 1 + PIP_QUIET = 1 + JSON_SCHEMA_TEST_SUITE = {toxinidir}/json coverage,ghcoverage: MAYBE_COVERAGE=coverage run -m @@ -24,9 +27,9 @@ allowlist_externals = mkdir sh commands = - noextra: {envpython} -m pip install --disable-pip-version-check {toxinidir} - format,perf,perfsuite: {envpython} -m pip install --disable-pip-version-check '{toxinidir}[format]' - formatnongpl: {envpython} -m pip install --disable-pip-version-check '{toxinidir}[format-nongpl]' + noextra: {envpython} -m pip install {toxinidir} + format,perf: {envpython} -m pip install '{toxinidir}[format]' + formatnongpl: {envpython} -m pip install '{toxinidir}[format-nongpl]' audit: {envpython} -m pip_audit audit-formatnongpl: {envpython} -m piplicenses {posargs} --ignore-packages pip-requirements-parser pip_audit pip-api --allow-only="Apache Software License;ISC License (ISCL);MIT License;BSD License;Mozilla Public License 2.0 (MPL 2.0)" @@ -40,15 +43,16 @@ commands = coverage: {envpython} -m coverage html --directory={envtmpdir}/htmlcov ghcoverage: sh {toxinidir}/.github/coverage.sh "{envpython}" - perf: {envpython} {toxinidir}/jsonschema/benchmarks/issue232.py --inherit-environ JSON_SCHEMA_TEST_SUITE {posargs:--output {envtmpdir}/bench-issue232.json} - perfsuite: {envpython} {toxinidir}/jsonschema/benchmarks/json_schema_test_suite.py --inherit-environ JSON_SCHEMA_TEST_SUITE {posargs:--output {envtmpdir}/bench-json_schema_test_suite.json} + perf-create: {envpython} {toxinidir}/jsonschema/benchmarks/validator_creation.py {posargs:--output {envtmpdir}/bench-create.json} + perf-232: {envpython} {toxinidir}/jsonschema/benchmarks/issue232.py {posargs:--output {envtmpdir}/bench-issue232.json} + perf-suite: {envpython} {toxinidir}/jsonschema/benchmarks/json_schema_test_suite.py --inherit-environ JSON_SCHEMA_TEST_SUITE {posargs:--output {envtmpdir}/bench-json_schema_test_suite.json} deps = audit: pip-audit audit-formatnongpl: pip-licenses build: build - perf,perfsuite: pyperf + perf: pyperf tests,coverage,ghcoverage: twisted |