HomePlaygroundExpressionsDocsDriversStatusChangelog GitHub
← Back to Benchmarks
10 Million Queries

🐍 Python IPC: 2x Faster Than PyO3

Pure Python socket client outperforms FFI binding

December 27, 2025

🚀 Python IPC vs PyO3 Benchmark

248,524
IPC q/s
122,000
PyO3 q/s
2.0x
Improvement
🎯 Key Insight: A pure Python socket client connecting to qail-daemon is 2x faster than the PyO3 FFI approach. No Rust compilation needed for Python apps - just pip install and connect!

10 Million Query Results

Driver Queries/sec vs PyO3 Notes
Python IPC (new) 248,524 2.0x Pure Python, socket+json
PyO3 (current qail-py) 122,000 baseline Rust FFI with GIL handling
asyncpg 16,000 0.13x Sequential queries

Usage: Pure Python, No Compilation

from qail_ipc import connect

# Connect to qail-daemon
client = connect()
client.connect_pg("localhost", 5432, "user", "db", "")

# Prepare once, execute many
handle = client.prepare("SELECT id, name FROM users LIMIT $1")

# Execute 10K queries in one batch
params = [["10"], ["5"], ["1"]] * 3333
count = client.prepared_pipeline(handle, params)
            

Why IPC is Faster Than PyO3

Aspect PyO3 (FFI) IPC (Socket)
GIL Handling Complex py.allow_threads Automatic (socket I/O)
Build Requires maturin + Rust Pure Python, pip install
Memory Shared Python/Rust heap Isolated processes
Prepared Stmts Limited caching Daemon caches all stmts

IPC Performance Across Languages

Language IPC Queries/sec vs Previous
Python IPC 248,524 2.0x vs PyO3
Go IPC 237,561 99% of pgx
Native Rust 355,000 baseline
🐍 Python is Actually Faster Than Go!
Python IPC (248K) beats Go IPC (237K) by 4.6%. Python's json module (C-optimized) and simpler socket handling give it an edge.

Conclusion

The qail-daemon IPC approach transforms Python database access:

🎯 Bottom Line

2x
faster than PyO3
248K
queries/second
0
Rust deps needed

← All Benchmarks