kcar RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <kcar-public@bogomips.org>
To: kcar-public@bogomips.org
Subject: [PATCH 3/6] response: remove unnecessary constant alias
Date: Sun,  5 Mar 2017 23:13:13 +0000	[thread overview]
Message-ID: <20170305231316.8645-4-kcar-public@bogomips.org> (raw)
In-Reply-To: <20170305231316.8645-1-kcar-public@bogomips.org>

Constant lookups are inline-cached in modern Rubies,
so this is a waste of memory.
---
 lib/kcar/response.rb | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/kcar/response.rb b/lib/kcar/response.rb
index c74bb4b..af15ca0 100644
--- a/lib/kcar/response.rb
+++ b/lib/kcar/response.rb
@@ -6,10 +6,6 @@
 class Kcar::Response
   attr_accessor :sock, :hdr, :unchunk, :buf, :parser
 
-  # :stopdoc:
-  Parser = Kcar::Parser
-  # :startdoc:
-
   # By default we readpartial at most 16K off a socket at once
   READ_SIZE = 0x4000
 
@@ -17,7 +13,8 @@ class Kcar::Response
   # method.  +unchunk+ may be set to disable transparent unchunking
   # +hdr+ may be a Hash, Array, or Rack::Utils::HeaderHash
   def initialize(sock, hdr = {}, unchunk = true)
-    @sock, @hdr, @unchunk, @buf, @parser = sock, hdr, unchunk, "", Parser.new
+    @sock, @hdr, @unchunk, @buf =  sock, hdr, unchunk, ""
+    @parser = Kcar::Parser.new
   end
 
   # returns a 3-element array that resembles a Rack response, but is
-- 
EW


  parent reply	other threads:[~2017-03-05 23:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-05 23:13 [PATCH 0/6] more minor doc updates Eric Wong
2017-03-05 23:13 ` [PATCH 1/6] update documentation for contributions, remove private address Eric Wong
2017-03-11 21:31   ` [PATCH] HACKING: remove copy+pasted line about N Eric Wong
2017-03-05 23:13 ` [PATCH 2/6] doc: minor updates to describe classes, better Eric Wong
2017-03-05 23:13 ` Eric Wong [this message]
2017-03-05 23:13 ` [PATCH 4/6] response: more documentation cleanups Eric Wong
2017-03-05 23:13 ` [PATCH 5/6] favor require_relative to speed up loading Eric Wong
2017-03-05 23:13 ` [PATCH 6/6] response: remove Ruby 1.8-compatibility check 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/kcar/

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

  git send-email \
    --in-reply-to=20170305231316.8645-4-kcar-public@bogomips.org \
    --to=kcar-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/kcar.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).