From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.25.37.80 with SMTP id l77csp253026lfl; Fri, 3 Oct 2014 13:08:39 -0700 (PDT) Return-Path: Received-SPF: pass (google.com: domain of rack-devel+bncBD4PTDWJVIEBBRUEXSQQKGQEYRIQDLI@googlegroups.com designates 10.140.100.162 as permitted sender) client-ip=10.140.100.162 Authentication-Results: mr.google.com; spf=pass (google.com: domain of rack-devel+bncBD4PTDWJVIEBBRUEXSQQKGQEYRIQDLI@googlegroups.com designates 10.140.100.162 as permitted sender) smtp.mail=rack-devel+bncBD4PTDWJVIEBBRUEXSQQKGQEYRIQDLI@googlegroups.com; dkim=pass header.i=@googlegroups.com X-Received: from mr.google.com ([10.140.100.162]) by 10.140.100.162 with SMTP id s31mr253230qge.17.1412366919369 (num_hops = 1); Fri, 03 Oct 2014 13:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=date:from:to:subject:message-id:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type:content-disposition; bh=+k/bmDl1P2h0TAo7nmlqn+JC7lKY7F5nIOi2zQacgF4=; b=hvIUecod+5MVgE/6uVw2lOzMc7HtO8rwm1NbNBUJc7+kaZ6opp6H5RCnOJ61A2dA1E nE15sKN35XE9/yreXT0myu48JcrqcO8KPiELXuuAaEHkLHsDMxih4aOxguzydmFsdW05 kYiwCwa6hZMZLirFtkjJ+Q8S88YKLX2ot1oQsG3CFdEBoNCBBUy+ljDmRo524fIwEAbi cPa0UzuZ6+vIZ9XPab/g640kOBzUYjm2nDSwpHNssWrHi804EjOZCpRKfui23VagpRpJ pj8QYftkKij3yBDHKOb3qGK4ZKTzEgKqjlAg3s6BoF3n4YYTiUnOURy1qK/6t6L2ZzBp yLew== X-Received: by 10.140.100.162 with SMTP id s31mr28444qge.17.1412366918929; Fri, 03 Oct 2014 13:08:38 -0700 (PDT) X-BeenThere: rack-devel@googlegroups.com Received: by 10.140.88.84 with SMTP id s78ls1253289qgd.22.gmail; Fri, 03 Oct 2014 13:08:38 -0700 (PDT) X-Received: by 10.52.108.131 with SMTP id hk3mr6703587vdb.6.1412366918235; Fri, 03 Oct 2014 13:08:38 -0700 (PDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net. [64.71.152.64]) by gmr-mx.google.com with ESMTP id l7si720922pdn.0.2014.10.03.13.08.37 for ; Fri, 03 Oct 2014 13:08:38 -0700 (PDT) Received-SPF: none (google.com: e@80x24.org does not designate permitted sender hosts) client-ip=64.71.152.64; Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 824241F7C5; Fri, 3 Oct 2014 20:08:37 +0000 (UTC) Date: Fri, 3 Oct 2014 20:08:37 +0000 From: Eric Wong To: rack-devel@googlegroups.com Subject: Re: Less allocated objects on each request Message-ID: <20141003200836.GA4664@dcvr.yhbt.net> MIME-Version: 1.0 X-Original-Sender: e@80x24.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: e@80x24.org does not designate permitted sender hosts) smtp.mail=e@80x24.org Reply-To: rack-devel@googlegroups.com 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: , Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Hi all, this is about a recent rack.git commit: dc53a8c26dc55d21240233b3d83d36efdef6e924 I don't disagree with this commit at this time, but I hope much of it will become unnecessary as older versions of Ruby get phased out. Since Ruby 2.1.0, constant string keys are deduplicated in hash literals. Thus the following reuses the same "key" string in every case: { "key" => val } # ref: r44058 Ruby 2.2 (coming December 2014) will also deduplicate the "key" literal allocation for lookups and assignment on regular hashes: regular_hash["key"] # opt_aref_with (in insns.def) regular_hash["key"] = val # opt_aset_with This speeds up the Rack env hash, but unfortunately won't help with Rack::Utils::HeaderHash :< (ref: r44551 + a few subsequent bugfixes) We originally planned to support dedupe for all strings (not just literals), but that caused performance regressions :< On a related note, Ruby 2.2 will also use power-of-two sized hash tables, speeding up lookups/assignments a little (~10-20%, CPU-dependent) for String keys [Feature #9425] This only applies to mainline Ruby, I am not up-to-date with Rubinius/JRuby internals. Thanks for reading! -- --- 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.