Project

General

Profile

Actions

Feature #6615

closed

Release GVL in zlib when calling inflate() or deflate()

Added by drbrain (Eric Hodel) about 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
[ruby-core:45733]

Description

This patch switches from zstream_run from using rb_thread_schedule() to rb_thread_blocking_region().

I don't see a way to safely interrupt deflate() or inflate() so the unblocking function is empty.

This patch should allow use of output buffer sizes larger than 16KB. I suspect 16KB was chosen to allow reasonable context-switching time for ruby 1.8 and earlier. A larger buffer size would reduce GVL contention when processing large streams.

An alternate way to reduce GVL contention would be to move zstream_run's loop outside the GVL, but some manual allocation would be required as currently the loop uses a ruby String as the output buffer.


Files

zlib.release_gvl.patch (2.32 KB) zlib.release_gvl.patch drbrain (Eric Hodel), 06/21/2012 09:20 AM
zlib.release_gvl.2.patch (5.3 KB) zlib.release_gvl.2.patch Move entire run loop outside GVL drbrain (Eric Hodel), 06/21/2012 03:56 PM
zlib.release_gvl.3.patch (5.35 KB) zlib.release_gvl.3.patch drbrain (Eric Hodel), 06/26/2012 08:27 AM
Actions

Also available in: Atom PDF