io_splice RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Iñaki Baz Castillo" <ibc@aliax.net>
To: ruby.io.splice@librelist.com
Subject: Re: Some benchmarks
Date: Thu, 23 Dec 2010 16:41:36 +0100	[thread overview]
Message-ID: <AANLkTinWjEtU-aa-paHaw042jrt-AveWzwNfQqfhM1dS@mail.gmail.com> (raw)
In-Reply-To: 20101222195646.GB20567@dcvr.yhbt.net

2010/12/22 Eric Wong <normalperson@yhbt.net>:
>> I don't understand why in the last test (big file, 1000 copies)
>> io_splice takes so long, maybe it takes more time initializing each
>> object within the benchmark block?
>
> It'ls likely the test wrote enough to force blocking writes to disk,
> and your disk is now the bottleneck.  In that case, all the memory
> tricks in the world won't help :)

Aha, it makes sense.


> Try it on a tmpfs mount.

Yes, that would be my next test.


> Also, relying on GC to close file descriptors could be a small
> performance problem given the number of iterations.

Well, this is just a strange use case test. Indeed I should call
File.close by myself.



>>    # We use a pipe as a ring buffer in kernel space.
>>    # pipes may store up to IO::Splice::PIPE_CAPA bytes
>>    pipe = IO.pipe
>
> You can reuse the pipe object through multiple runs assuming you drain
> it properly.

So I need to learn what "draining a pipe" means. I assume I need to
empty/rewind it. I suppose there ar API methods for this.



>> I've tryed to declare source, source_fd and pipe = IO.pipe before the
>> benchmark block but then I get empty copied files (I need to declare
>> all of them within the benchmark block). I assume the test script can
>> be improved.
>
> You need to rewind source if you don't specify an input offset for splice.
> Likewise for the dest and destination offset.  The open+close is part of
> the test for the FileUtils things, though, so I would just open close
> (you were leaving the close up to GC, which usually fine for MRI but not
> for benchmark purposes).

Ok. Thanks a lot!



-- 
Iñaki Baz Castillo
<ibc@aliax.net>

  reply	other threads:[~2010-12-23 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTi=M+qGa7G1PvYyB+fbJUzrersJQwtDkct3hZEiy@mail.gmail.com>
2010-12-22 14:01 ` Some benchmarks Iñaki Baz Castillo
2010-12-22 19:56   ` Eric Wong
2010-12-23 15:41     ` Iñaki Baz Castillo [this message]
2010-12-23 18:06       ` Eric Wong
2010-12-27 10:01         ` Iñaki Baz Castillo
2010-12-27 17:33       ` Iñaki Baz Castillo
2010-12-27 21:38         ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/ruby_io_splice/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinWjEtU-aa-paHaw042jrt-AveWzwNfQqfhM1dS@mail.gmail.com \
    --to=ibc@aliax.net \
    --cc=ruby.io.splice@librelist.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/ruby_io_splice.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).