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 ranran.nagaokaut.ac.jp (ranran.nagaokaut.ac.jp [133.44.2.25]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id BEC271F0378 for ; Thu, 13 Mar 2008 09:50:19 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by ranran.nagaokaut.ac.jp (Postfix) with ESMTP id 97B1E466A16 for ; Thu, 13 Mar 2008 09:48:48 +0900 (JST) Received: from localhost (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 1D80E8FC5F for ; Thu, 13 Mar 2008 09:48:40 +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 UYwEl+EMTNLJ for ; Thu, 13 Mar 2008 09:48:39 +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 F0F298FC5B for ; Thu, 13 Mar 2008 09:48:39 +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 B9014630021 for ; Thu, 13 Mar 2008 09:48:39 +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 108CA3C21D391; Thu, 13 Mar 2008 09:48:21 +0900 (JST) Received: from mail.asahi-net.or.jp (mail2.asahi-net.or.jp [202.224.39.198]) by carbon.ruby-lang.org (Postfix) with ESMTP id 197E53C21F732 for ; Thu, 13 Mar 2008 09:48:17 +0900 (JST) Received: from [192.168.1.2] (u049184.dynamic.ppp.asahi-net.or.jp [203.212.49.184]) by mail.asahi-net.or.jp (Postfix) with ESMTP id 9244B557AF for ; Thu, 13 Mar 2008 09:48:27 +0900 (JST) Delivered-To: ruby-core@ruby-lang.org Date: Thu, 13 Mar 2008 09:48:17 +0900 Posted: Thu, 13 Mar 2008 09:48:27 +0900 From: Daniel DeLorme Reply-To: ruby-core@ruby-lang.org Subject: Re: Copy-on-write friendly garbage collector To: ruby-core@ruby-lang.org Message-Id: <47D879DB.9010602@dan42.com> In-Reply-To: <47D811A6.1050805@plan99.net> References: <47D2255C.2010205@dan42.com> <47D24561.9090909@dan42.com> <47D811A6.1050805@plan99.net> X-ML-Name: ruby-core X-Mail-Count: 15879 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= User-Agent: Thunderbird 1.5.0.14 (X11/20071210) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on carbon.ruby-lang.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=7.0 tests=AWL,BAYES_40, CONTENT_TYPE_PRESENT,RCVD_IN_CBL,RCVD_NUMERIC_HELO2 autolearn=disabled version=3.1.7 X-Original-To: ruby-core@ruby-lang.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Hongli Lai wrote: > Great work Daniel. I don't measure the same amount of speedup that you > claim in your email, but there is definitely a small speedup. > > I've added some further further optimizations. > find_position_in_bitfield() now uses bit operators instead of division > and modulo operators. This should speed things up a little more. > > The attached patch is created against Ruby 1.8, but it shows what I've > exactly changed. Thank you. I also looked at find_position_in_bitfield() but I assumed the compiler would be able to make those optimizations, so ended up not touching it. I notice that this patch is relative to one of the patches that I submitted. But in those patches I changed the bsearch to a linear search, which may not be desirable as Matz pointed out. But I'm not sure it's a good idea to sacrifice performance now for the sake of a hypothetical change in heap size in the future (YAGNI). Maybe a #define could take care of that? e.g. #ifdef FEW_HEAPS order heaps by size, linear search #else order heaps by memory location, bsearch #endif -- Daniel