From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id D97D217C22F8 for ; Thu, 7 Jul 2011 07:14:47 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 42C55EA6617 for ; Thu, 7 Jul 2011 07:26:27 +0900 (JST) Received: from localhost (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 710418FC59 for ; Thu, 7 Jul 2011 07:26:27 +0900 (JST) X-Virus-Scanned: amavisd-new at funfun.nagaokaut.ac.jp Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by localhost (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8BM7bjQhArYv for ; Thu, 7 Jul 2011 07:26:27 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 35FEE8FC19 for ; Thu, 7 Jul 2011 07:26:27 +0900 (JST) Received: from carbon.ruby-lang.org (carbon.ruby-lang.org [221.186.184.68]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 2CF7095241E for ; Thu, 7 Jul 2011 07:26:25 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [127.0.0.1]) by carbon.ruby-lang.org (Postfix) with ESMTP id F28F73C21F12C; Thu, 7 Jul 2011 07:26:21 +0900 (JST) Received: from izmunuti.segment7.net (izmunuti.segment7.net [70.86.236.98]) by carbon.ruby-lang.org (Postfix) with ESMTP id 5971B3C21F119 for ; Thu, 7 Jul 2011 07:26:17 +0900 (JST) Received: from izmunuti.segment7.net (localhost [127.0.0.1]) by izmunuti.segment7.net (Postfix) with ESMTP id 4FAE6B2434 for ; Wed, 6 Jul 2011 15:26:16 -0700 (PDT) Received: from izmunuti.segment7.net ([127.0.0.1]) by izmunuti.segment7.net (izmunuti.segment7.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WHO53FbWtb4Z for ; Wed, 6 Jul 2011 15:26:01 -0700 (PDT) Received: from [192.168.1.190] (dsl231-038-147.sea1.dsl.speakeasy.net [216.231.38.147]) by izmunuti.segment7.net (Postfix) with ESMTPSA id 91991B2421 for ; Wed, 6 Jul 2011 15:26:00 -0700 (PDT) Delivered-To: ruby-core@ruby-lang.org Date: Thu, 7 Jul 2011 07:26:18 +0900 Posted: Wed, 6 Jul 2011 15:25:58 -0700 From: Eric Hodel Reply-To: ruby-core@ruby-lang.org Subject: [ruby-core:37835] Re: [Ruby 1.9 - Bug #4962] come back gem_prelude! To: ruby-core@ruby-lang.org Message-Id: In-Reply-To: References: X-ML-Name: ruby-core X-Mail-Count: 37835 X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only members can post) X-ML-Info: If you have a question, send e-mail with the body "help" (without quotes) to the address ruby-core-ctl@ruby-lang.org; help= X-Mailer: Apple Mail (2.1084) X-Spam-Checker-Version: SpamAssassin 3.1.7-deb3 (2006-10-05) on carbon.ruby-lang.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=7.0 tests=ARIN,BAYES_40, CONTENT_TYPE_PRESENT,MIMEQENC,QENCPTR1,QENCPTR2,RCVD_IN_CHINA, RCVD_IN_CHINA_KR,RCVD_IN_TAIWAN,X_MAILER_PRESENT autolearn=disabled version=3.1.7-deb3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=segment7.net; h= x-mailer:references:message-id:content-transfer-encoding:date :date:in-reply-to:from:from:subject:subject:mime-version :content-type:content-type:received:received; s=200904; t= 1309991161; bh=nx4cha98rEb1hmIW5r80Ucd72wmI4+nOU2VdUtyXnL8=; b=Y f7BRxYWXQMkO0UeCD2WqxBXgdGH01NsqrwqBgzDjy9/R+tNVuuj9JjAbsSWR69b9 rejzPbuDyOJWYlijjmf27mgav+bFC3TBqoxfFZIs9QNYxz1L8coVxmEjZYuoRw8u F3zI6lTBu/dniIfFBgpMXLD4AaLYNhy9alpy6VfpGw= Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk List-Id: ruby-core.ruby-lang.org List-Software: fml [fml 4.0.3 release (20011202/4.0.3)] List-Post: List-Owner: List-Help: List-Unsubscribe: On Jul 6, 2011, at 3:02 PM, Benoit Daloze wrote: > On 6 July 2011 23:21, Eric Hodel wrote: >>=20 >> Please try r32429 >=20 > I just tried, and here are some numbers. > Surprising how such a change can move numbers. >=20 > $ time ruby -e '' > before: 0.045 > no-gems: 0.013 > after: 0.024 >=20 > $ ruby -e 'p ObjectSpace.count_objects[:TOTAL]' > before: 20033 > no-gems: 9811 > after: 14308 I'm unsure if TOTAL is counting what we think it's counting. It seems = to be showing the size of the object space not the number of allocated = objects. If you add allocated and FREE from the output below you'll get = TOTAL. $ cat diffhash.rb=20 gems =3D eval `#{Gem.ruby} -e 'GC.start; p ObjectSpace.count_objects' = | grep '{'` no_gems =3D eval `#{Gem.ruby} --disable-gems -e 'GC.start; p = ObjectSpace.count_objects' | grep '{'` gems[:allocated] =3D gems.select { |k,_| k.to_s.start_with? 'T_' }.values.inject :+ no_gems[:allocated] =3D no_gems.select { |k,_| k.to_s.start_with? 'T_' }.values.inject :+ puts " gems no_gems diff" gems.keys.sort.each do |key| a =3D gems[key].to_i b =3D no_gems[key].to_i puts "%-10s %8d %8d %8d" % [key, a, b, a - b] end $ ./ruby19 diffhash.rb=20 gems no_gems diff FREE 6793 7357 -564 TOTAL 14309 9811 4498 T_ARRAY 226 20 206 T_BIGNUM 3 3 0 T_CLASS 474 425 49 T_COMPLEX 1 1 0 T_DATA 347 117 230 T_FILE 3 3 0 T_FLOAT 7 7 0 T_HASH 7 3 4 T_ICLASS 19 18 1 T_MODULE 21 18 3 T_NODE 3185 27 3158 T_OBJECT 7 6 1 T_REGEXP 24 8 16 T_STRING 3192 1798 1394 allocated 7516 2454 5062 Also, the GC runs once at ruby startup: $ ruby19 --disable-gems -e 'GC::Profiler.enable; require "rubygems"; = puts GC::Profiler.result' GC 1 invokes. Index Invoke Time(sec) Use Size(byte) Total Size(byte) = Total Object GC Time(ms) 1 0.009 288200 409000 = 10225 0.41599999999999970335 Increasing HEAP_MIN_SLOTS to 20000 eliminates the initial garbage = collection: $ RUBY_HEAP_MIN_SLOTS=3D20000 ruby19 --disable-gems -e = 'GC::Profiler.enable; require "rubygems"; puts GC::Profiler.result' heap_min_slots=3D20000 (10000)