diff --git a/Makefile b/Makefile index 0b361de63..f860ae6aa 100644 --- a/Makefile +++ b/Makefile @@ -131,20 +131,6 @@ testcov: build-coverage .PHONY: all all: format build-dev lint test -.PHONY: flame -flame: - @rm -rf perf.data* - @rm -rf flame - @mkdir -p flame - perf record -g profiling/dict_model.py - perf script --max-stack 20 | stackcollapse-perf.pl | flamegraph.pl > flame/python.svg - perf script --max-stack 20 | stackcollapse-perf.pl > flame/python.txt - @rm perf.data - JSON=1 perf record -g profiling/dict_model.py - perf script --max-stack 20 | stackcollapse-perf.pl | flamegraph.pl > flame/json.svg - perf script --max-stack 20 | stackcollapse-perf.pl > flame/json.txt - @rm perf.data - .PHONY: clean clean: rm -rf `find . -name __pycache__` @@ -153,7 +139,6 @@ clean: rm -f `find . -type f -name '.*~' ` rm -rf src/self_schema.py rm -rf .cache - rm -rf flame rm -rf htmlcov rm -rf .pytest_cache rm -rf *.egg-info diff --git a/profiling/dict_model.py b/profiling/dict_model.py deleted file mode 100755 index 9c22e622b..000000000 --- a/profiling/dict_model.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python3 -""" -This is used to generate flamegraphs, usage: - - perf record -g benchmarks/minimal.py - -Then: - - perf script | stackcollapse-perf.pl | flamegraph.pl > flame.svg - -Or just - - make flame - -As per https://gist.github.com/KodrAus/97c92c07a90b1fdd6853654357fd557a -""" -import os -from pydantic_core import SchemaValidator, ValidationError -import json - -size = 5 -v = SchemaValidator( - { - 'title': 'MyTestModel', - 'type': 'list', - 'items': {'type': 'model', 'fields': {f'f_{i}': {'type': 'str'} for i in range(size)}}, - } -) -# print(repr(v)) - -d = [{f'f_{i}': f'foobar_{i}' for i in range(size)} for _ in range(50)] -if os.getenv('JSON'): - print('running validate_json...') - j = json.dumps(d) - for i in range(100_000): - r = v.validate_json(j) -else: - print('running validate_python...') - for i in range(100_000): - r = v.validate_python(d) -# debug(r) - -try: - r = v.validate_python({'name': 'John', 'age': 16, 'friends': [-1, 2, 3, -1], 'settings': {'a': 1.0, 'b': 2.0}}) -except ValidationError as e: - # print(e) - pass