From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.devel Subject: Re: goops and memoization Date: Thu, 21 Nov 2002 19:49:18 -0500 Sender: guile-devel-admin@gnu.org Message-ID: References: Reply-To: djurfeldt@nada.kth.se NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1037926417 21743 80.91.224.249 (22 Nov 2002 00:53:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 22 Nov 2002 00:53:37 +0000 (UTC) Cc: djurfeldt@nada.kth.se, Dirk Herrmann , guile-devel@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18F24c-0005eY-00 for ; Fri, 22 Nov 2002 01:53:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18F24A-0004aN-00; Thu, 21 Nov 2002 19:53:06 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18F23k-0004DL-00 for guile-devel@gnu.org; Thu, 21 Nov 2002 19:52:40 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18F23i-0004D4-00 for guile-devel@gnu.org; Thu, 21 Nov 2002 19:52:39 -0500 Original-Received: from kvast.blakulla.net ([213.212.20.77]) by monty-python.gnu.org with esmtp (Exim 4.10) id 18F23h-0004Cz-00 for guile-devel@gnu.org; Thu, 21 Nov 2002 19:52:37 -0500 Original-Received: from linnaeus ([18.42.2.46]) by kvast.blakulla.net with esmtp (Exim 3.36 #1 (Debian)) id 18F20V-0004Dk-00; Fri, 22 Nov 2002 01:49:19 +0100 Original-Received: from mdj by linnaeus with local (Exim 3.36 #1 (Debian)) id 18F20U-0008Vv-00; Thu, 21 Nov 2002 19:49:18 -0500 Original-To: Neil Jerram Original-Cc: djurfeldt@nada.kth.se In-Reply-To: (Neil Jerram's message of "21 Nov 2002 20:31:48 +0000") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1739 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1739 Neil Jerram writes: > Mikael> Benchmarks show that GOOPS method dispatch is > Mikael> negligible and a GOOPS generic function nearly as > Mikael> efficient as an ordinary closure. > > Are those benchmarks available? Checkout the guile/guile-modules/benchmarks CVS module at subversions.gnu.org. There should be a benchmark goops.scm. You run it with (type-dispatch-run). > If I do change the code, it would be good to check that the changes > don't hurt performance. Yes. I would like to be able to continue using GF:s in the inner loops of my applications. > Mikael> Currently, compile-method only makes sure the method has a > Mikael> local next-method binding (specific to this method cache > Mikael> entry) if that is needed. However, there are plans to let > Mikael> it make powerful optimizations of the code, with great > Mikael> potential of reducing overhead. > > Do you mean IOR ? Some of the optimizations mentioned in the IOR text can be done in current GOOPS. > If so, couldn't most IOR optimizations be made when the method is > first defined? No. They are dependent on the actual argument types in the application, not the possible ones. BTW, maybe I should add something I didn't mention about GOOPS type dispatch: The method cache uses hashing if the number of methods goes above a small threshold. This hashing scheme uses an optimization which allows for direct hits of the correct entry in the majority of lookups. Method cache hash optimization scheme ------------------------------------- The basic idea is to compute a hash code from the actual arguments of an application and reduce this code to a hash index in the cache. The type of each argument is represented by a class object. Each class object has 8 hash values. (Hash values # 1 of all classes in the system constitutes "hash set 1" etc.) When building the method cache, all hash sets are tried, and the one which gives most direct hits is chosen. Information about which hash set is used is stored in the GF object. Apart from optimizing dispatch this also results in compact representations of the method caches. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel