From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from mail-pg0-x23e.google.com (mail-pg0-x23e.google.com [IPv6:2607:f8b0:400e:c05::23e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A4E2C20285 for ; Thu, 29 Jun 2017 02:19:20 +0000 (UTC) Received: by mail-pg0-x23e.google.com with SMTP id j186sf5736474pge.1 for ; Wed, 28 Jun 2017 19:19:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1498702760; cv=pass; d=google.com; s=arc-20160816; b=ojlLbOSOMp2H16epUuLiAkjSqmB9hMGfZGjzOyCJ+28A8McuA5tdrBDMmKzGr+pu+Q 9UHgmdXXbf7yk/bhdh8DI4UwaqSnLJYy7BCiHTdKk6y/ZIeCHgr5tc9085sOED1Qx5L/ 7brZ8ssgXK/MEVaOKaKMi5UuuXKpZxTOh2usBDZg8Ywrb4zjtGTjh0azuN1BWxL++Gej OJEyG6eb+lTWghKAGGOzhDNNl313ApTuGsBTUlfT+z09tkyDW6kXDkozdKhV7T74sXkX 2Gat2rop9mpet97W4cxi03dK1tPl2GdWQyRLJQuiBa3qQuCkTiNbZznJmuM2x1xnF+5B Kitg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:references:in-reply-to :message-id:date:subject:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=G96PAIx7wNTSi/+/TY2sTQTV+qrkXyZVCIlpe8Ai5tI=; b=msjyWa87h/w0ReCSnvNf8/Na1CIzreWQBRh2VNG8fLg3JZem4oyx0FFY+TotPmd+r0 U4q0NTsRPPHxNMxuXYOLD0GW//+a1Kjg8ItCaRqlNmVCrH397rXigIsimivUuAU6wItG GO+7E1SFbNgxjr8FPbOSWgSAZZGxcT3cnKjPiYhvuuwZzKlhC8dL8okZT/9rXxrdxi+6 0u5hmd3ORwjrANUHgzALoIAqN1xrIwoOCNTT9r9TdynBAA2Zeb4X2Zvxa1A7DqrLI4ye ZMaJNqlhM/443vksolHke5cydHG1WFxC//+saMaTWrItBzoRlcFMRZYRqX/q9CWmd9Zc oK5Q== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) smtp.mailfrom=e@80x24.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=G96PAIx7wNTSi/+/TY2sTQTV+qrkXyZVCIlpe8Ai5tI=; b=nNwAasb16SnbcVhKIwRXn0JCNiCItHF1tqTTOO/c5Ap9leL4Rfh8Vx/CZvhbwWC3dt 7q3o8ThYkMFGMGCOEoOCrsFSoyiJBrXjODu/FsR9taX0d8KwtvXlhGSUm0zcTLQbi8yh DmaQOIJyPQOKwFp+p5I1e/e4MMiwga1DlkzbAJticsQCtULHYnGcG3pPloI4jz1avpvN Y6UoQvQ5R19E68XxSknzI1xqtCioFe8QGmqDBoSHzjY07OaoKmiLwEz9SILDSQ5C7Svd +Xm6eZP+Y5YmsBuLUwUaJ5lGfDllToOaAsnw0JXTydEO7FIPWBnZZgPqkPpTl/Fn/UcM JcWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=G96PAIx7wNTSi/+/TY2sTQTV+qrkXyZVCIlpe8Ai5tI=; b=ZuA48BsGcOFl8+mLcYH4G0IuKNwNGI/KceniYsxdwe1NTZ+n+g/Jd7kgeKfj0p0MCD 913DimxYb1/n0r0E7nt//0W+RIAw67DGWzLC819G8eCHhmd6VCETBnEK9A4S6gSXRH4o jpQL1bvZ3sQjFp7GjCOKqxspSn21LCyzjllOrmEWo+7S6pXrWJ5JdvPiEaR0gC1ZtM74 RC4l6wryQdsTMRO2mqtcmkOo+mIxLulTWQjnKnJz9/YbzLM4muXITQOVrbzF2LVo/89Y zIPBmxCV4HuN24gWk18fMf4oJOtHoWre8JDP31vkD4MxXtlcN6wfYCqKLN6GAn8oefw0 1E1Q== Sender: rack-devel@googlegroups.com X-Gm-Message-State: AIVw113bEl9N3NgCqNhUx4tvS1SeOiDOXcoUseFbYQrI2Vd90dKrJk3X z4HJ4s3T1HrtRA== X-Received: by 10.36.26.85 with SMTP id 82mr177334iti.6.1498702760252; Wed, 28 Jun 2017 19:19:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rack-devel@googlegroups.com Received: by 10.36.87.212 with SMTP id u203ls3509889ita.7.canary-gmail; Wed, 28 Jun 2017 19:19:19 -0700 (PDT) X-Received: by 10.13.241.69 with SMTP id a66mr8551648ywf.71.1498702759808; Wed, 28 Jun 2017 19:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498702759; cv=none; d=google.com; s=arc-20160816; b=cXJbzw0Aze4wmX1f+gKQcHp3CBGZbBx3eSR+VAa8+zw/V/BxGfVqcfvmsX/2K2jcfD YzPJbUQk7DID3fS/UbNX/YURSVid5ZArMXcl1IRzJ2tbHLIUJ3gWu80UKerKITyQnxA+ VLpKMCOg5PbMBXgWVfg2zPOWGpUHjQ2HC1hXTc1fiPnYV+dIIiESZJpGXoGUKcdXE/Pu P+PEW5gXTe3m3xNTcz1JgrRCLjoYapvmh843s1RMlLhuSdic+HyhZBwr8VACFDguM/t2 1HiyrMcMOb/L6Ux48e3S9kmWM5QvqLrEtpWAuFonIHRPrjefpxOw1hzMGCQYAjSn2kzF Vruw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :arc-authentication-results; bh=NDKUNbrlYHslSX76VioZf7y+2je5Me+pLbTo1gfgTJ0=; b=iszlfiJqxdB5Ecq98sY9uGo/Hdk4tJfXXFUI2Pgcs1uSnc6Dd+bPSq19JZfI1So9jV XkKQtLYXPa0oakFV7rr80OYB1K6r1dvidsLdtD2eYSq6oy0qXT2hPMEPAN+BQshAnRUP QxEx8lC4w5JGJhlSUyBPLVjvrEHjvb5lO1Vk3N9o2Y/ClGU2N167F2VWKq24AupaysBz HyLCCRs+3Y1OmI5QbiKoWQn+0QZPKoNI1IsH94Qo542RpnZvgbdcQhwb6H1vutCINqRg j3KwuVgIuoAEPK3tAlV6aBjV/+s9IKpTB/NBkLXB9BBpdvPKPr/6wJYg43HQ7qch6X1p YcBg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) smtp.mailfrom=e@80x24.org Received: from dcvr.yhbt.net (dcvr.yhbt.net. [2600:3c01::f03c:91ff:fe96:f5d6]) by gmr-mx.google.com with ESMTPS id e62si819172pfh.1.2017.06.28.19.19.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 19:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) client-ip=2600:3c01::f03c:91ff:fe96:f5d6; Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A157820286 for ; Thu, 29 Jun 2017 02:19:15 +0000 (UTC) From: Eric Wong To: rack-devel@googlegroups.com Subject: [PATCH 2/5] deflater: avoid wasting an ivar slot on @closed Date: Thu, 29 Jun 2017 02:19:12 +0000 Message-Id: <20170629021915.22517-3-e@80x24.org> In-Reply-To: <20170629021915.22517-1-e@80x24.org> References: <20170629021915.22517-1-e@80x24.org> X-Original-Sender: e@80x24.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of e@80x24.org designates 2600:3c01::f03c:91ff:fe96:f5d6 as permitted sender) smtp.mailfrom=e@80x24.org Reply-To: rack-devel@googlegroups.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: X-Google-Group-Id: 486215384060 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , We can merely set the @body to nil ensure we do not call close on the @body, twice. Saving an ivar slot can save 8 bytes per object at minimum, and this makes me feel more comfortable about using another ivar for the next commit. --- lib/rack/deflater.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/rack/deflater.rb b/lib/rack/deflater.rb index 9b798ba..d575adf 100644 --- a/lib/rack/deflater.rb +++ b/lib/rack/deflater.rb @@ -70,7 +70,6 @@ module Rack def initialize(body, mtime) @body = body @mtime = mtime - @closed = false end def each(&block) @@ -91,9 +90,8 @@ module Rack end def close - return if @closed - @closed = true @body.close if @body.respond_to?(:close) + @body = nil end end -- EW -- --- You received this message because you are subscribed to the Google Groups "Rack Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.