From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DE0E52030F for ; Sun, 14 Feb 2016 22:06:26 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH] http_context: reduce constant lookup + bytecode Date: Sun, 14 Feb 2016 22:06:26 +0000 Message-Id: <20160214220626.13842-1-e@80x24.org> List-Id: 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