IO::EventReleases

Releases

v1.14.0

Enhanced IO::Event::PriorityHeap with deletion and bulk insertion methods

The class IO::Event::PriorityHeap now supports efficient element removal and bulk insertion:

heap = IO::Event::PriorityHeap.new

# Efficient bulk insertion - O(n) instead of O(n log n)
heap.concat([5, 2, 8, 1, 9, 3])

# Remove specific element
removed = heap.delete(5)  # Returns 5, heap maintains order

# Bulk removal with condition
count = heap.delete_if{|x| x.even?}  # Removes 2, 8 efficiently

The delete_if and concat methods are particularly efficient for bulk operations, using bottom-up heapification to maintain the heap property in O(n) time. This provides significant performance improvements:

Both methods maintain the heap invariant and include comprehensive test coverage with edge case validation.

v1.11.2

v1.11.1

v1.11.0

Introduce IO::Event::WorkerPool for off-loading blocking operations.

The IO::Event::WorkerPool provides a mechanism for executing blocking operations on separate OS threads while properly integrating with Ruby's fiber scheduler and GVL (Global VM Lock) management. This enables true parallelism for CPU-intensive or blocking operations that would otherwise block the event loop.

# Fiber scheduler integration via blocking_operation_wait hook
class MyScheduler
	def initialize
		@worker_pool = IO::Event::WorkerPool.new
	end

  def blocking_operation_wait(operation)
    @worker_pool.call(operation)
  end
end

# Usage with automatic offloading
Fiber.set_scheduler(MyScheduler.new)
# Automatically offload `rb_nogvl(..., RB_NOGVL_OFFLOAD_SAFE)` to a background thread:
result = some_blocking_operation()

The implementation uses one or more background threads and a list of pending blocking operations. Those operations either execute through to completion or may be cancelled, which executes the "unblock function" provided to rb_nogvl.

v1.10.2

v1.10.0

v1.9.0

v1.8.0

v1.7.5