From: "drbrain (Eric Hodel)" Date: 2012-06-21T15:56:25+09:00 Subject: [ruby-core:45747] [ruby-trunk - Feature #6615] Release GVL in zlib when calling inflate() or deflate() Issue #6615 has been updated by drbrain (Eric Hodel). File zlib.release_gvl.2.patch added This second patch moves the entire run loop outside the GVL, but messes with the internals of String to expand z->buf. This patch allows large streams to be processed without GVL contention. ---------------------------------------- Feature #6615: Release GVL in zlib when calling inflate() or deflate() https://bugs.ruby-lang.org/issues/6615#change-27330 Author: drbrain (Eric Hodel) Status: Open Priority: Normal Assignee: Category: ext Target version: 2.0.0 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. -- http://bugs.ruby-lang.org/