From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D30F620955 for ; Thu, 16 Mar 2017 03:14:14 +0000 (UTC) From: Eric Wong 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> In-Reply-To: <20170316031412.16713-1-e@80x24.org> References: <20170316031412.16713-1-e@80x24.org> List-Id: 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