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 CB0CB17C22F8 for ; Thu, 7 Jul 2011 06:09:33 +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 EA895EA6765 for ; Thu, 7 Jul 2011 06:21:12 +0900 (JST) Received: from localhost (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 1781B8FC57 for ; Thu, 7 Jul 2011 06:21:13 +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 MSV8lIiC9GP7 for ; Thu, 7 Jul 2011 06:21:12 +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 D0A788FC1B for ; Thu, 7 Jul 2011 06:21:12 +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 E189A952408 for ; Thu, 7 Jul 2011 06:21:11 +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 5B8BF3C21EB6C; Thu, 7 Jul 2011 06:21:10 +0900 (JST) Received: from fluorine.ruby-lang.org (www.rubyist.net [210.251.121.216]) by carbon.ruby-lang.org (Postfix) with ESMTP id 213593C21F133 for ; Thu, 7 Jul 2011 06:21:08 +0900 (JST) Received: from ruby-lang.org (localhost [127.0.0.1]) by fluorine.ruby-lang.org (Postfix) with ESMTP id 11AD53ED2D for ; Thu, 7 Jul 2011 06:21:08 +0900 (JST) Delivered-To: ruby-core@ruby-lang.org Date: Thu, 7 Jul 2011 06:21:08 +0900 Posted: Thu, 7 Jul 2011 06:21:08 +0900 From: Eric Hodel Reply-To: ruby-core@ruby-lang.org Subject: [ruby-core:37833] [Ruby 1.9 - Bug #4962] come back gem_prelude! To: ruby-core@ruby-lang.org Message-Id: References: X-ML-Name: ruby-core X-Mail-Count: 37833 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: Redmine 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.4 required=7.0 tests=BAYES_50,CONTENT_TYPE_PRESENT, FORGED_RCVD_HELO,RCVD_IN_CHINA,RCVD_IN_CHINA_KR,RCVD_IN_TAIWAN, X_MAILER_PRESENT autolearn=disabled version=3.1.7-deb3 X-Redmine-Issue-Author: mame X-Redmine-Issue-Assignee: drbrain X-Redmine-Issue-Id: 4962 X-Redmine-Mailinglistintegration-Message-Ids: 7088 X-Redmine-Project: ruby-19 Auto-Submitted: auto-generated X-Redmine-Site: Ruby Issue Tracking System X-Redmine-Host: redmine.ruby-lang.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 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: Issue #4962 has been updated by Eric Hodel. Please try r32429 ---------------------------------------- Bug #4962: come back gem_prelude! http://redmine.ruby-lang.org/issues/4962 Author: Yusuke Endoh Status: Assigned Priority: Normal Assignee: Eric Hodel Category: lib Target version: 1.9.3 ruby -v: - Hello, rubygems developers Kosaki-san noticed that 1.9.3 is slower than 1.9.2 on many benchmarks. http://www.atdot.net/sp/view/5qunnl I investigated and found that the cause is the lack of gem_prelude.rb. Loading rubygems seems to create many objects and keep the references to them. See below: $ ruby -ve 'GC.start; p ObjectSpace.count_objects[:TOTAL]' ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] 9821 $ ./ruby -ve 'GC.start; p ObjectSpace.count_objects[:TOTAL]' ruby 1.9.3dev (2011-07-01 trunk 32356) [i686-linux] 19638 $ ./ruby --disable-gems -ve 'GC.start; p ObjectSpace.count_objects[:TOTAL]' ruby 1.9.3dev (2011-07-01 trunk 32356) [i686-linux] 9821 The number of live objects is proportional to the cost of GC mark phase. You can actually confirm the performance degradation with the following benchmark script: require 'tempfile' max = 200_000 str = "Hello world! " * 1000 f = Tempfile.new('yarv-benchmark') f.write str GC::Profiler.enable max.times{ f.seek 0 f.read } p GC::Profiler.total_time $ time ruby -v bm_io_file_read.rb ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] 0.7280460000000308 real 0m3.965s user 0m2.940s sys 0m1.024s $ time ./ruby -v bm_io_file_read.rb ruby 1.9.3dev (2011-07-01 trunk 32356) [i686-linux] 1.396088000000029 real 0m4.786s user 0m3.716s sys 0m1.060s $ time ./ruby --disable-gems -v bm_io_file_read.rb ruby 1.9.3dev (2011-07-01 trunk 32356) [i686-linux] 0.7640390000000309 real 0m4.079s user 0m2.872s sys 0m1.192s The performance degradation can be seen by not only such micro benckmarks, but also my puzzle solvers :-( There are some approaches to address the problem: 1. to introduce a generational GC; this is impossible until 2.0 because it requires modifications to all extension libraries. 2. to diet rubygems; do not create any string, array, hash, and any object as much as possible, and do not keep the references to them. 3. to restore gem_prelude.rb to delay loading rubygems. I guess that 3 is a reasonable choice for 1.9.3. But I'm fine with any solution to fix rubygems if 1.9.3 becomes as fast as 1.9.2 on the benchmarks. -- Yusuke Endoh -- http://redmine.ruby-lang.org