ThreadFactory 1.1.0
๐ ThreadFactory 1.1.0 โ Smarter Threads, Stronger Structures
High-performance thread-safe collections and concurrency primitives for Python 3.13+ Free Threading (No-GIL).
This release introduces a powerful new data structure โ ConcurrentBuffer โ plus dynamic semaphores, bulk update enhancements, and core refinements for cleaner operation under pressure.
โจ Whatโs New in 1.1.0
๐งฉ New Concurrent Structures
๐ท ConcurrentBuffer
- A high-throughput, sharded buffer optimized for low-to-moderate contention workloads.
- Balances concurrency using internal timestamp-tagged shards.
- Outperforms
ConcurrentQueueby up to 60% in 4โ20 thread scenarios. - Ideal for producer/consumer pipelines and approximate-FIFO coordination.
๐ถ Dynaphore
- A dynamic semaphore abstraction with runtime tunable limits.
- Allows increasing or decreasing concurrency capacity on-the-fly.
- Perfect for adaptive workloads or dynamic backpressure strategies.
๐ ๏ธ Feature Enhancements
- โ
Bulk
update(...)support forConcurrentBagandConcurrentList - โ
Added
.remove(item)toConcurrentQueueandConcurrentStackfor more flexible usage - โ
ConcurrentStackandConcurrentQueuenow include micro-sleeps (time.sleep(0.001)) to reduce tight-loop contention and provide natural backpressure under load - โ Unit tests now include optional performance benchmarks โ clone and run to compare against Pythonโs built-ins
๐งน Fixes & Refactors
- ๐ Switched from relative to absolute imports for better modular packaging
- ๐ Minor consistency improvements across
peek,clear, and__repr__methods - ๐งช Refined
Emptyexception handling for consistency across all structures
๐ฆ Install / Upgrade
pip install --upgrade threadfactorySupports Python 3.13+ โ Free Threading (No-GIL) builds recommended for maximum concurrency.
๐ฎ Roadmap Highlights
๐ Next Up โ v1.2
-
โ Work-stealing thread pool executor
Dynamic task distribution using a local + global queue model with stealing for idle threads. -
โ Dynamic task orchestration
IntroducingWork,Future, andCancellationTokenobjects for structured concurrency and result handling. -
โ Pluggable queue strategies
Support for custom task queues including priority queues and circular buffers. -
โ Graceful shutdown + restart
Controlled thread pool lifecycle with support for cancelable tasks, soft exits, and full reset.
๐ Compare Performance Yourself
Clone and run:
python -m unittest discover -v tests/Benchmarks included for:
ConcurrentBuffervsConcurrentQueuevsmultiprocessing.Queue- Real-world 8M+ ops producer/consumer tests
GIL-enabledvsNo-GILexecution modes
๐ง Built for Engineers Who Think in Threads
ThreadFactory continues its mission to bring .NET-style concurrency to Python โ but without GIL constraints.
Fast, flexible, and optimized for Free Threading in Python 3.13+.
Build high-performance systems. Think in parallel. Own the thread.
MIT License ยฉ 2025 Mark Geleta (Synaptic724)