Skip to content

Benchmarks for perf #1756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion tests/benchmarks/test_serialization_micro.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ def r():
fs_model_serializer.to_python(m, exclude_unset=True)


@pytest.mark.benchmark(group='model-list-json')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this line was unintentionally removed to the below, needs reverting

def test_model_list_core_json(benchmark):
s = SchemaSerializer(
core_schema.model_schema(
Expand Down Expand Up @@ -360,6 +359,33 @@ def r():
v.to_python(d, mode='json')


@pytest.mark.benchmark(group='model-list-json')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the benchmark group on all these temporal tests should be adjusted, maybe group='temporal'?

def test_datetime_seconds(benchmark):
v = SchemaSerializer(
core_schema.datetime_schema(),
config={
'ser_json_temporal': 'seconds',
},
)
d = datetime(2022, 12, 2, 12, 13, 14)
assert v.to_python(d, mode='json') == 1669983194.0

@benchmark
def r():
v.to_python(d, mode='json')


@pytest.mark.benchmark(group='model-list-json')
def test_datetime_milliseconds(benchmark):
v = SchemaSerializer(core_schema.datetime_schema(), config={'ser_json_temporal': 'milliseconds'})
d = datetime(2022, 12, 2, 12, 13, 14)
assert v.to_python(d, mode='json') == 1669983194000.0

@benchmark
def r():
v.to_python(d, mode='json')


@pytest.mark.benchmark(group='model-list-json')
def test_uuid(benchmark):
v = SchemaSerializer(core_schema.uuid_schema())
Expand Down
Loading