raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / Atom feed
From: Eric Wong <e@80x24.org>
To: raindrops-public@bogomips.org
Subject: [PATCH 3/3] aggregate/pmq: avoid File#stat allocation
Date: Thu, 16 Mar 2017 03:14:12 +0000
Message-ID: <20170316031412.16713-4-e@80x24.org> (raw)
In-Reply-To: <20170316031412.16713-1-e@80x24.org>

File#size is available in modern Rubies so the extra syscall
is avoided.
---
 lib/raindrops/aggregate/pmq.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/raindrops/aggregate/pmq.rb b/lib/raindrops/aggregate/pmq.rb
index 5a6a1f6..98d4169 100644
--- a/lib/raindrops/aggregate/pmq.rb
+++ b/lib/raindrops/aggregate/pmq.rb
@@ -153,7 +153,7 @@ def aggregate
       Marshal.load(synchronize(@rd, RDLOCK) do |rd|
         dst = StringIO.new
         dst.binmode
-        IO.copy_stream(rd, dst, rd.stat.size, 0)
+        IO.copy_stream(rd, dst, rd.size, 0)
         dst.string
       end)
     end
-- 
EW


  parent reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16  3:14 [PATCH 0/3] aggregate/pmq: various fixes and cleanups Eric Wong
2017-03-16  3:14 ` [PATCH 1/3] aggregate/pmq: avoid false sharing of lock buffers Eric Wong
2017-03-16  3:14 ` [PATCH 2/3] aggregate/pmq: remove io-extra requirement Eric Wong
2017-03-16  3:14 ` Eric Wong [this message]
2017-03-21 23:48 ` [PATCH 0/3] aggregate/pmq: various fixes and cleanups Eric Wong

Reply instructions:

You may reply publically 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://bogomips.org/raindrops/

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

  git send-email \
    --in-reply-to=20170316031412.16713-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=raindrops-public@bogomips.org \
    /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

raindrops RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/raindrops-public
	git clone --mirror http://ou63pmih66umazou.onion/raindrops-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox