Skip to content

Conversation

AdolfoVillalobos
Copy link
Contributor

@AdolfoVillalobos AdolfoVillalobos commented Aug 27, 2024

Change Summary

I created three tests to benchmark Pydantic's performance in basic categories:

  • Schema generation
  • Serialization
  • Validation.

The tests handle varying levels of complexity ranging from simple tests to nested scenarios, inspired by the pydantic-core test suite.

Related issue number

Contributes to #9711

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Tests pass on CI
  • Documentation reflects the changes where applicable
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@github-actions github-actions bot added the relnotes-fix Used for bugfixes. label Aug 27, 2024
@AdolfoVillalobos AdolfoVillalobos mentioned this pull request Aug 27, 2024
12 tasks
Copy link

codspeed-hq bot commented Aug 27, 2024

CodSpeed Performance Report

Merging #10240 will not alter performance

Comparing AdolfoVillalobos:test/expand-breadth-of-benchmarks (5bd3887) with main (9ad349a)

Summary

✅ 17 untouched benchmarks

🆕 13 new benchmarks

Benchmarks breakdown

Benchmark main AdolfoVillalobos:test/expand-breadth-of-benchmarks Change
🆕 test_complex_model_schema_generation N/A 3.4 ms N/A
🆕 test_nested_model_schema_generation N/A 3.6 ms N/A
🆕 test_recursive_model_schema_generation N/A 1.9 ms N/A
🆕 test_simple_model_schema_generation N/A 1.5 ms N/A
🆕 test_complex_model_serialization N/A 52.4 µs N/A
🆕 test_list_of_models_serialization N/A 62.7 µs N/A
🆕 test_model_json_serialization N/A 57.2 µs N/A
🆕 test_nested_model_serialization N/A 44.1 µs N/A
🆕 test_simple_model_serialization N/A 34.8 µs N/A
🆕 test_complex_model_validation N/A 58.1 µs N/A
🆕 test_list_of_models_validation N/A 100.2 µs N/A
🆕 test_nested_model_validation N/A 57.3 µs N/A
🆕 test_simple_model_validation N/A 44.3 µs N/A

@AdolfoVillalobos
Copy link
Contributor Author

I'm lost as to why the tests are failing. I can't see how my code is impacting them. I would really appreciate some advice ;) Thanks!

@Viicos
Copy link
Member

Viicos commented Aug 27, 2024

Thanks for taking a stab at this. Regarding the benchmarks related to core schema generation, I'll probably expand these to meet my needs (related to #10223). I'll make sure to add you as a co-author.

@sydney-runkle sydney-runkle added relnotes-ignore Omit this PR from the release notes. and removed relnotes-fix Used for bugfixes. labels Aug 27, 2024
@sydney-runkle
Copy link
Contributor

Hmm, test failure does seem odd.

@AdolfoVillalobos, amazing work here - thanks for helping us to expand our benchmarks!

@sydney-runkle
Copy link
Contributor

So odd, I can't repo that test failure locally, even when pulling your changes

@sydney-runkle sydney-runkle enabled auto-merge (squash) August 27, 2024 13:21
Copy link
Contributor

@sydney-runkle sydney-runkle left a comment

Choose a reason for hiding this comment

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

I'll investigate this test failure on a separate branch, but have pushed a patch fix for now.

@sydney-runkle sydney-runkle merged commit 9b72ef3 into pydantic:main Aug 27, 2024
58 checks passed
Copy link
Contributor

Coverage report

This PR does not seem to contain any modification to coverable code.

@AdolfoVillalobos
Copy link
Contributor Author

Thanks for taking a stab at this. Regarding the benchmarks related to core schema generation, I'll probably expand these to meet my needs (related to #10223). I'll make sure to add you as a co-author.

I'm glad this PR was helpful ;) Thanks!

@AdolfoVillalobos
Copy link
Contributor Author

I'll investigate this test failure on a separate branch, but have pushed a patch fix for now.

Yess, it was a bit odd. I still don't quite get what was broken.

In any case, thanks for the help and support ;).

I love this project; It has helped me many times, so I am happy and proud to make my first contribution. Hopefully, I will continue to contribute in the future ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-ignore Omit this PR from the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants