Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

ThreadFactory 1.1.0

Choose a tag to compare

@Synaptic724 Synaptic724 released this 27 Mar 09:14
· 502 commits to production since this release

๐Ÿš€ 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 ConcurrentQueue by 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 for ConcurrentBag and ConcurrentList
  • โœ… Added .remove(item) to ConcurrentQueue and ConcurrentStack for more flexible usage
  • โœ… ConcurrentStack and ConcurrentQueue now 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 Empty exception handling for consistency across all structures

๐Ÿ“ฆ Install / Upgrade

pip install --upgrade threadfactory

Supports 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
    Introducing Work, Future, and CancellationToken objects 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:

  • ConcurrentBuffer vs ConcurrentQueue vs multiprocessing.Queue
  • Real-world 8M+ ops producer/consumer tests
  • GIL-enabled vs No-GIL execution 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)