samuel / oriontransfer.org wrote:
> Does Ruby `File.read` and `File.stat` (and others) release the GVL? Otherwise, the performance benefit of multiple threads in this specific case is irrelevant. While I agree with you when writing high performance servers in C/C++, it might not be directly relevant to Ruby as it currently stands.

File.read does.   File.stat does not, at the moment.  I tried
it a while back but the GVL is expensive to release for hot
cache situations(*).

File.open, IO.copy_stream, IO#write, IO#read, readpartial, sysread,
syswrite all release GVL, too.

In particular, IO.copy_stream is great for large, parallel
transfers to/from high-latency storage.


(*) the cost of GVL for quick ops is a big reason I want to get rid of it

    But yeah, maybe the small regression from releasing GVL is
    acceptable for now with File.stat.  It's better than getting
    stufk on NFS or slow disks.

    File.rename, File.unlink, most Dir methods all have the same
    problem with slow storage, too.  We already pay the price
    for small regressions when releasing GVL in current cases,
    so maybe those can be GVL release points.

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>