unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: unicorn-public@bogomips.org
Subject: [PATCH] tmpio: drop the "size" method
Date: Sun, 28 Dec 2014 07:17:25 +0000	[thread overview]
Message-ID: <20141228071725.GA30694@dcvr.yhbt.net> (raw)
In-Reply-To: <20141228070655.GA28587@dcvr.yhbt.net>

Eric Wong <e@80x24.org> wrote:
> But there ought to be tiny gains made from dropping 1.8 support,
> so I'll probably go ahead and do it...

Tiny stuff like this:
----------------------------8<-------------------------
From: Eric Wong <e@80x24.org>
Subject: [PATCH] tmpio: drop the "size" method

It is redundant given the existence of File#size in Ruby 1.9+

This saves 1440 bytes of bytecode on x86-64 under 2.2.0,
and at least another 120 bytes for the method entry,
hash table entry, and method definition overhead.
---
 lib/unicorn/tmpio.rb | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/lib/unicorn/tmpio.rb b/lib/unicorn/tmpio.rb
index 2da05a2..c97979a 100644
--- a/lib/unicorn/tmpio.rb
+++ b/lib/unicorn/tmpio.rb
@@ -21,9 +21,4 @@ class Unicorn::TmpIO < File
     fp.sync = true
     fp
   end
-
-  # for easier env["rack.input"] compatibility with Rack <= 1.1
-  def size
-    stat.size
-  end unless File.method_defined?(:size)
 end
-- 
EW


  reply	other threads:[~2014-12-28  7:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-16  8:32 [RFC] http: TypedData C-API conversion Eric Wong
2014-12-28  7:06 ` Eric Wong
2014-12-28  7:17   ` Eric Wong [this message]
2015-12-24 18:57   ` 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/unicorn/

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

  git send-email \
    --in-reply-to=20141228071725.GA30694@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=unicorn-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
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/unicorn.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).