yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: yahns-public@yhbt.net
Subject: [PATCH] http_context: reduce constant lookup + bytecode
Date: Sun, 14 Feb 2016 22:06:26 +0000	[thread overview]
Message-ID: <20160214220626.13842-1-e@80x24.org> (raw)

This saves about 100 bytes of iseq overhead based
on my measurements.
 lib/yahns/http_context.rb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/yahns/http_context.rb b/lib/yahns/http_context.rb
index c02eefd..40f2c58 100644
--- a/lib/yahns/http_context.rb
+++ b/lib/yahns/http_context.rb
@@ -82,8 +82,7 @@ def tmpio_for(len, env)
     # short requests are most common
     if len && len <= @client_body_buffer_size;
       # Can't use binmode, yet: https://bugs.ruby-lang.org/issues/11945
-      tmp = StringIO.new
-      tmp.set_encoding(Encoding::ASCII_8BIT)
+      tmp = StringIO.new(''.dup)
     else # too big or chunked, unknown length
       tmp = @input_buffer_tmpdir
       mbs = @client_max_body_size

                 reply	other threads:[~2016-02-14 22:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

  List information: https://yhbt.net/yahns/README

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

  git send-email \
    --in-reply-to=20160214220626.13842-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=yahns-public@yhbt.net \


* 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


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).