From b4cff50e8e79e7e40baad614556e7563d1860740 Mon Sep 17 00:00:00 2001 From: Eden Kirin Date: Wed, 11 Oct 2023 21:26:35 +0200 Subject: [PATCH] Readme --- README.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ poetry.lock | 20 +------------------ pyproject.toml | 1 - 3 files changed, 54 insertions(+), 20 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..911094d --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Pydantic vs MsgSpec + +Libs used for benchmark: + +- [pydantic 2.4.2](https://docs.pydantic.dev/latest/) +- [msgspec 0.18.4](https://jcristharif.com/msgspec/index.html) + +## Usage + +### Install virtual environment + +``` +poetry install +``` + +### Create test data + +- Edit `benchmark/factories.py` and set `COLUMNS_COUNT` and `PLANOGRAMS_COUNT` to desired size. +- Uncomment `create_test_file(TEST_DATA_FILE)` line in main.py +- Run main.py + +You can comment back this line after json test file is created. + +### Run benchmark + +``` +python main.py +``` + +## Results + +``` +*** Running PydanticBenchmark +Finished in 10.781s +*** Running MsgSpecBenchmark +Finished in 1.725s +``` + +``` +██████╗ ██╗ ██╗██████╗ █████╗ ███╗ ██╗████████╗██╗ ██████╗ +██╔══██╗╚██╗ ██╔╝██╔══██╗██╔══██╗████╗ ██║╚══██╔══╝██║██╔════╝ +██████╔╝ ╚████╔╝ ██║ ██║███████║██╔██╗ ██║ ██║ ██║██║ +██╔═══╝ ╚██╔╝ ██║ ██║██╔══██║██║╚██╗██║ ██║ ██║██║ +██║ ██║ ██████╔╝██║ ██║██║ ╚████║ ██║ ██║╚██████╗ +╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝ + +██╗ ██╗ ██████╗ ██╗ ██╗ ███████╗██╗ ██╗ ██████╗██╗ ██╗ ██████╗ █████╗ ██╗ ██╗ ███████╗ +╚██╗ ██╔╝██╔═══██╗██║ ██║ ██╔════╝██║ ██║██╔════╝██║ ██╔╝ ██╔══██╗██╔══██╗██║ ██║ ██╔════╝ + ╚████╔╝ ██║ ██║██║ ██║ ███████╗██║ ██║██║ █████╔╝ ██████╔╝███████║██║ ██║ ███████╗ + ╚██╔╝ ██║ ██║██║ ██║ ╚════██║██║ ██║██║ ██╔═██╗ ██╔══██╗██╔══██║██║ ██║ ╚════██║ + ██║ ╚██████╔╝╚██████╔╝ ███████║╚██████╔╝╚██████╗██║ ██╗ ██████╔╝██║ ██║███████╗███████╗███████║ + ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ +``` diff --git a/poetry.lock b/poetry.lock index 4642ac3..19fbbbc 100644 --- a/poetry.lock +++ b/poetry.lock @@ -11,24 +11,6 @@ files = [ {file = "annotated_types-0.6.0.tar.gz", hash = "sha256:563339e807e53ffd9c267e99fc6d9ea23eb8443c08f112651963e24e22f84a5d"}, ] -[[package]] -name = "factory-boy" -version = "3.3.0" -description = "A versatile test fixtures replacement based on thoughtbot's factory_bot for Ruby." -optional = false -python-versions = ">=3.7" -files = [ - {file = "factory_boy-3.3.0-py2.py3-none-any.whl", hash = "sha256:a2cdbdb63228177aa4f1c52f4b6d83fab2b8623bf602c7dedd7eb83c0f69c04c"}, - {file = "factory_boy-3.3.0.tar.gz", hash = "sha256:bc76d97d1a65bbd9842a6d722882098eb549ec8ee1081f9fb2e8ff29f0c300f1"}, -] - -[package.dependencies] -Faker = ">=0.7.0" - -[package.extras] -dev = ["Django", "Pillow", "SQLAlchemy", "coverage", "flake8", "isort", "mongoengine", "sqlalchemy-utils", "tox", "wheel (>=0.32.0)", "zest.releaser[recommended]"] -doc = ["Sphinx", "sphinx-rtd-theme", "sphinxcontrib-spelling"] - [[package]] name = "faker" version = "19.9.0" @@ -295,4 +277,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "c2ab39cad71a6932e73868eb4f8513ca8fcf3c01d5337bf463607f9a1ab7be06" +content-hash = "f67f7e3c078da6291615ead8743e8eb520d31e62bab449b5cd5f3e9b3b3f540e" diff --git a/pyproject.toml b/pyproject.toml index 8588915..7a99786 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,6 @@ packages = [{include = "pydantic_vs_msgspec"}] python = "^3.11" pydantic = "^2.4.2" msgspec = "^0.18.4" -factory-boy = "^3.3.0" polyfactory = "^2.9.0"