Skip to main content

3 posts tagged with "performance"

performance tag description

View All Tags

Benchmark: msgspec vs. Pydantic v2

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

msgspec is an extremely fast serialization and validation library that consistently outperforms Pydantic v2 in benchmarks. This performance advantage comes from its design as a lean, compiled-code-based library focused on a narrow set of data handling tasks, whereas Pydantic v2 is a feature-rich framework.

The performance differences are most pronounced in two key areas: parsing/decoding (converting data like JSON into Python objects) and serialization/encoding (converting Python objects into data like JSON).

How to Measure Execution Time of a Function in Python (With Examples)

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Measuring how long your Python code takes to run is a critical skill for performance optimization, profiling, or benchmarking different approaches to solving a problem. Python offers many tools for tracking the execution time of a function - from simple built-in methods to full-blown profilers.

In this guide, we will explore multiple methods with code examples to help you choose the right one for your use case.

Best Practices for Using msgspec in Python for High-Performance Serialization

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

msgspec is a high-performance serialization library designed for modern Python applications. It combines type-safe data modeling, blazing-fast parsing, and flexible support for multiple serialization formats, including MessagePack, JSON, and TOML.

This article outlines the best practices for integrating msgspec into your codebase. It provides a practical, performance-oriented guide to writing cleaner, safer, and faster Python services.