From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: GMP bignum results using double cells. Date: Wed, 26 Feb 2003 00:28:54 -0600 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <878yw3o8rd.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 1046240956 13075 80.91.224.249 (26 Feb 2003 06:29:16 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 26 Feb 2003 06:29:16 +0000 (UTC) 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 18nv47-0003Ol-00 for ; Wed, 26 Feb 2003 07:29:15 +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 18nv4A-0007t7-03 for guile-devel@m.gmane.org; Wed, 26 Feb 2003 01:29:18 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18nv3p-0007p0-00 for guile-devel@gnu.org; Wed, 26 Feb 2003 01:28:57 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18nv3n-0007nG-00 for guile-devel@gnu.org; Wed, 26 Feb 2003 01:28:56 -0500 Original-Received: from dsl093-098-016.wdc1.dsl.speakeasy.net ([66.93.98.16] helo=defaultvalue.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18nv3n-0007my-00 for guile-devel@gnu.org; Wed, 26 Feb 2003 01:28:55 -0500 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id A45A613BF0 for ; Wed, 26 Feb 2003 00:28:54 -0600 (CST) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id 7A533D187D; Wed, 26 Feb 2003 00:28:54 -0600 (CST) Original-To: guile-devel@gnu.org User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) 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:1983 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1983 OK. I'd say that's a bit better -- guile-gmp-old is the smob based implementation with the extra indirection. guile-gmp has bignums that store the mpz_t inside the 3 words of a double cell. $ ./run-benchmark guile-1.6 ./guile-1.7 ./guile-gmp-old ./guile-gmp foo.scm starting trials ("bench-random-op +" "guile-1.6" ((user . 206) (sys . 0) (gc . 91))) ("bench-random-op -" "guile-1.6" ((user . 186) (sys . 1) (gc . 59))) ("bench-random-op *" "guile-1.6" ((user . 226) (sys . 0) (gc . 101))) ("bench-random-op /" "guile-1.6" ((user . 267) (sys . 0) (gc . 116))) ("bench-random-op gcd" "guile-1.6" ((user . 126) (sys . 0) (gc . 46))) ("bench-random-op lcm" "guile-1.6" ((user . 288) (sys . 0) (gc . 121))) starting trials ("bench-random-op +" "./guile-1.7" ((user . 353) (sys . 1) (gc . 62))) ("bench-random-op -" "./guile-1.7" ((user . 327) (sys . 0) (gc . 62))) ("bench-random-op *" "./guile-1.7" ((user . 364) (sys . 0) (gc . 56))) ("bench-random-op /" "./guile-1.7" ((user . 392) (sys . 0) (gc . 56))) ("bench-random-op gcd" "./guile-1.7" ((user . 276) (sys . 0) (gc . 59))) ("bench-random-op lcm" "./guile-1.7" ((user . 392) (sys . 0) (gc . 57))) starting trials ("bench-random-op +" "./guile-gmp-old" ((user . 414) (sys . 0) (gc . 66))) ("bench-random-op -" "./guile-gmp-old" ((user . 399) (sys . 0) (gc . 65))) ("bench-random-op *" "./guile-gmp-old" ((user . 438) (sys . 0) (gc . 68))) ("bench-random-op /" "./guile-gmp-old" ((user . 434) (sys . 0) (gc . 65))) ("bench-random-op gcd" "./guile-gmp-old" ((user . 407) (sys . 0) (gc . 66))) ("bench-random-op lcm" "./guile-gmp-old" ((user . 466) (sys . 0) (gc . 67))) starting trials ("bench-random-op +" "./guile-gmp" ((user . 349) (sys . 1) (gc . 67))) ("bench-random-op -" "./guile-gmp" ((user . 302) (sys . 0) (gc . 32))) ("bench-random-op *" "./guile-gmp" ((user . 321) (sys . 0) (gc . 33))) ("bench-random-op /" "./guile-gmp" ((user . 334) (sys . 0) (gc . 32))) ("bench-random-op gcd" "./guile-gmp" ((user . 312) (sys . 0) (gc . 33))) ("bench-random-op lcm" "./guile-gmp" ((user . 366) (sys . 0) (gc . 32))) It looks like the new code is substantially better than 1.7, though if I understand correctly, and gc time is included in user time, then it appears the improvement was on the gc side, not the computation side. Marius, for now, rather than use SCM_CELL_ADDR_1, I mirrored the handling of real values like this: #define SCM_I_BIG_MPZ(x) (((scm_t_big_mpz *) SCM2PTR (x))->mpz) #define SCM_BIGP(x) (!SCM_IMP (x) && SCM_TYP16 (x) == scm_tc16_big) typedef struct scm_t_big_mpz { SCM type; mpz_t mpz; } scm_t_big_mpz; However, this means that numbers.h now has to include gmp.h, and with the SCM_CELL_ADDR_1 approach, it wouldn't. I'd be happy to arrange things whichever way you prefer. Also, I was trying to figure out how to add the test for sizeof (mpz_t) <= 3 * (sizeof (scm_t_bits)) In order to put it in configure.in, we have to have access to the definition of scm_t_bits (or at least SIZEOF_SCM_T_BITS) at configure time. Any thoughts? -- Rob Browning rlb @defaultvalue.org, @linuxdevel.com, and @debian.org Previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel