From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.devel Subject: Re: gmp issues (long) Date: 26 Feb 2003 00:01:41 +0100 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87of506k2y.fsf@zagadka.ping.de> References: <87d6lhcnyn.fsf@raven.i.defaultvalue.org> <87y9446pyc.fsf@zagadka.ping.de> <87wujoqado.fsf@raven.i.defaultvalue.org> <87smuc6lft.fsf@zagadka.ping.de> <87d6lgq8jn.fsf@raven.i.defaultvalue.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1046214463 24110 80.91.224.249 (25 Feb 2003 23:07:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 25 Feb 2003 23:07:43 +0000 (UTC) Cc: 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 18noAl-0006GO-00 for ; Wed, 26 Feb 2003 00:07:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18no6t-0003CK-04 for guile-devel@m.gmane.org; Tue, 25 Feb 2003 18:03:39 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18no6E-0002tY-00 for guile-devel@gnu.org; Tue, 25 Feb 2003 18:02:58 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18no5F-0001il-00 for guile-devel@gnu.org; Tue, 25 Feb 2003 18:02:29 -0500 Original-Received: from mail.dokom.net ([195.253.8.218]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18no4r-0001M1-00 for guile-devel@gnu.org; Tue, 25 Feb 2003 18:01:33 -0500 Original-Received: from dialin.speedway43.dip188.dokom.de ([195.138.43.188] helo=zagadka.ping.de) by mail.dokom.net with smtp (Exim 3.36 #3) id 18no57-0004Wm-00 for guile-devel@gnu.org; Wed, 26 Feb 2003 00:01:49 +0100 Original-Received: (qmail 22833 invoked by uid 1000); 25 Feb 2003 23:01:41 -0000 Original-To: Rob Browning In-Reply-To: <87d6lgq8jn.fsf@raven.i.defaultvalue.org> Original-Lines: 51 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:1979 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1979 Rob Browning writes: > Marius Vollmer writes: > > > The way I understand things, GMP does not allocate the mpz_t's itself, > > right? Then you should be able to do things like > > > > SCM z = scm_double_cell (bignum_tag, 0, 0, 0); > > mpz_init (SCM_CELL_ADDR_1 (z)); > > > where SCM_CELL_ADDR_1 or something similar needs to be added to gc.h. > > Hmm. Yep, that should work, and would be even faster. > > Any easy way we could rearrange things to that we allocate a double > cell without initializing its fields at all (until the mpz_init), > i.e. save the redundant init to 0, without causing trouble with the > GC? Possibly, but we would have to break into the scm_double_cell abstraction. I.e., we should _not_ provide a function that creates an unintialized double cell, but we might add another function that creates a double cell and simultaneously initializes it as a mpz_t. 'mpz_init' is probably very simple and maybe just initializing it with zeros is all it takes. Maybe the compiler can inline both scm_double_cell and mpz_init and optimize the redundant stores away. Also, maybe we can initialize a mpz_t by copying a constant struct into it (the way POSIX mutxes can be initialized): mpz_t n = MPZ_INITIALIZER; We can then have a new function that initializes a double cell from a 12-byte constant struct and then do: mpz_t scm_i_mpz_initializer = MPZ_INITIALIZER; ... z = scm_double_cell_from_struct (bignum_tag, (scm_t_bits *)&scm_i_mpz_initializer); > Anyway, thanks for the suggestion. I think I can get this working > pretty quickly so we can see how it fares. It'd be nice if it helps > out noticably on the performance side too... Hopefully! :-) -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel