Skip to main content

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.

How to Install a .deb Package on Ubuntu

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

Ubuntu, like other Debian-based systems, uses .deb files as the standard package format. While most software is installed via apt or the Ubuntu Software Center, sometimes you may need to install software manually using a .deb file you downloaded from a website or built yourself.

In this article, we’ll cover how to install .deb packages using the GUI and command line, how to resolve dependencies, and best practices for safe installation.

How to Stream Media Files from S3 Directly to AWS Lambda Using FFmpeg in Python

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

Processing media files inside AWS Lambda can be a challenge due to its resource limits, lack of a local disk, and timeouts. However, it’s entirely possible to stream files directly from S3 into FFmpeg, process them on the fly, and avoid writing anything to disk.

In this guide, we’ll cover:

  • Streaming files from S3 into Lambda
  • Using ffmpeg with stdin and stdout in memory
  • Avoiding /tmp bottlenecks
  • Examples and production-ready patterns

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.

Understanding Off-by-One Errors in JavaScript

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

Off-by-one errors (OBOEs) are among the most common logic bugs, even for seasoned developers. These bugs occur when a loop or operation goes one iteration too far or one iteration too short—leading to incorrect results, missed elements, or crashes.

They usually occur in:

  • Loops
  • Array indexing
  • Ranges
  • Substring operations

What is an Off-by-One Error in Python? (Explained for Kids!)

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

Have you ever counted your toys and accidentally said you had 11, but really only had 10? That’s kind of what an off-by-one error is in Python!

It’s a tiny mistake where your program counts 1 too many or 1 too few. These mistakes are super common, even for professional programmers.

Drawbacks of Msgspec Compared to Pydantic: A Deep Dive with Examples

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

msgspec is gaining attention in the Python ecosystem due to its incredible speed and minimalist design. It's written in Rust, supports JSON and MsgPack, and uses type hints for validation. But like every tool, it’s not perfect — and when compared to the battle-tested and feature-rich Pydantic, there are several key trade-offs to be aware of.

In this article, we’ll explore what msgspec lacks compared to Pydantic, illustrated with code examples and practical reasoning.

Handling Environment Variables in OpenAPI Server URLs

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

When defining server URLs in OpenAPI specs, you often need to reference environment-specific values (like staging or production subdomains). But using raw environment variables can result in placeholder values like default: unknown, which may confuse tools like Swagger UI, ReDoc, or code generators.

This guide explains the issue and offers clean solutions — with practical examples.

Python Data Serialization in 2025 - Alternatives to Pydantic and the Future Landscape

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

As of 2025, Pydantic remains a cornerstone of data validation and serialization in the Python ecosystem. Yet, with the evolving needs of performance-critical applications and broader standardization efforts in the language, new contenders have emerged — and old ones are adapting.

In this article, we explore the current landscape of Python data serialization libraries, their strengths, weaknesses, and futures.