Skip to content

276 python optimized - remove pydantic validation#501

Merged
antonputra merged 1 commit into
antonputra:mainfrom
ziehlke:feature/drop-pydantic-validation
Dec 31, 2025
Merged

276 python optimized - remove pydantic validation#501
antonputra merged 1 commit into
antonputra:mainfrom
ziehlke:feature/drop-pydantic-validation

Conversation

@ziehlke
Copy link
Copy Markdown
Contributor

@ziehlke ziehlke commented Dec 30, 2025

dropping Pydantic validation might potentially give massive performance boost
tested locally on MacBook Air M2, cpython3.14, postgres:18.1 via docker

Metric Baseline (Pydantic) Optimized (no Pydantic) Change
Requests/s 1,021 1,682 +65%
p50 (median) 26ms 5ms -81%
p95 90ms 20ms -78%
p99 200ms 62ms -69%
Max 765ms 396ms -48%
Total Requests (30s) 24,676 50,252 +104%

tested with locust

class FastApiUser(HttpUser):
    wait_time = between(0.04, 0.04)

    @task(1)
    def get_devices(self):
        self.client.get("/api/devices")

    @task(1)
    def create_user(self):
        payload = {
            "name": f"User-{uuid4()}",
            "address": f"Address-{random.randint(1, 1000)}",
            "phone": f"+1-{random.randint(100, 999)}-{random.randint(100, 999)}-{random.randint(1000, 9999)}",
        }
        self.client.post("/api/users", json=payload)

PS. @antonputra love your vids! much appreciated ❤️

Copy link
Copy Markdown
Owner

@antonputra antonputra left a comment

Choose a reason for hiding this comment

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

Thanks @ziehlke for the PR, I'll definitely test it out in the future!

@antonputra antonputra merged commit cd4a6a4 into antonputra:main Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants