# 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 ``` ``` ██████╗ ██╗ ██╗██████╗ █████╗ ███╗ ██╗████████╗██╗ ██████╗ ██╔══██╗╚██╗ ██╔╝██╔══██╗██╔══██╗████╗ ██║╚══██╔══╝██║██╔════╝ ██████╔╝ ╚████╔╝ ██║ ██║███████║██╔██╗ ██║ ██║ ██║██║ ██╔═══╝ ╚██╔╝ ██║ ██║██╔══██║██║╚██╗██║ ██║ ██║██║ ██║ ██║ ██████╔╝██║ ██║██║ ╚████║ ██║ ██║╚██████╗ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═════╝ ██╗ ██╗ ██████╗ ██╗ ██╗ ███████╗██╗ ██╗ ██████╗██╗ ██╗ ██████╗ █████╗ ██╗ ██╗ ███████╗ ╚██╗ ██╔╝██╔═══██╗██║ ██║ ██╔════╝██║ ██║██╔════╝██║ ██╔╝ ██╔══██╗██╔══██╗██║ ██║ ██╔════╝ ╚████╔╝ ██║ ██║██║ ██║ ███████╗██║ ██║██║ █████╔╝ ██████╔╝███████║██║ ██║ ███████╗ ╚██╔╝ ██║ ██║██║ ██║ ╚════██║██║ ██║██║ ██╔═██╗ ██╔══██╗██╔══██║██║ ██║ ╚════██║ ██║ ╚██████╔╝╚██████╔╝ ███████║╚██████╔╝╚██████╗██║ ██╗ ██████╔╝██║ ██║███████╗███████╗███████║ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ ```