yahns Ruby server user/dev discussion
 help / color / mirror / code / Atom feed
* [PATCH] http_context: reduce constant lookup + bytecode
@ 2016-02-14 22:06 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-02-14 22:06 UTC (permalink / raw)
  To: yahns-public

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
-- 
EW


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-14 22:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-14 22:06 [PATCH] http_context: reduce constant lookup + bytecode Eric Wong

Code repositories for project(s) associated with this inbox:

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