From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Llorens Newsgroups: gmane.lisp.guile.devel Subject: Re: array-copy! is slow & array-map.c Date: Wed, 3 Apr 2013 23:04:07 +0200 Message-ID: References: <919253B8-A19B-418F-9F2E-603A2AE9DC7E@bluewin.ch> <87r4irok1b.fsf@gnu.org> <877gkjo19a.fsf@gnu.org> <87mwtfmlap.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: multipart/mixed; boundary=Apple-Mail-187-168791434 X-Trace: ger.gmane.org 1365023066 27980 80.91.229.3 (3 Apr 2013 21:04:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 3 Apr 2013 21:04:26 +0000 (UTC) Cc: guile-devel To: =?iso-8859-1?Q?Ludovic_Court=E8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Apr 03 23:04:54 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UNUrV-00087S-7G for guile-devel@m.gmane.org; Wed, 03 Apr 2013 23:04:53 +0200 Original-Received: from localhost ([::1]:43767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNUr6-00077Q-Ew for guile-devel@m.gmane.org; Wed, 03 Apr 2013 17:04:28 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNUqw-00076z-2I for guile-devel@gnu.org; Wed, 03 Apr 2013 17:04:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNUqp-00084h-77 for guile-devel@gnu.org; Wed, 03 Apr 2013 17:04:18 -0400 Original-Received: from smtp4.infomaniak.ch ([2001:1600:2:5:92b1:1cff:fe01:18cc]:39451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNUqo-00084Y-OV; Wed, 03 Apr 2013 17:04:11 -0400 Original-Received: from [10.0.1.10] (209.114.63.81.cust.bluewin.ch [81.63.114.209]) (authenticated bits=0) by smtp4.infomaniak.ch (8.14.5/8.14.5) with ESMTP id r33L477D023471 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 3 Apr 2013 23:04:08 +0200 In-Reply-To: <87mwtfmlap.fsf@gnu.org> X-Mailer: Apple Mail (2.1085) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:1600:2:5:92b1:1cff:fe01:18cc X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16133 Archived-At: --Apple-Mail-187-168791434 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Attached 1st a patch with some array-copy! tests, then the array-fill! = patch split in two parts. Thanks! Daniel --Apple-Mail-187-168791434 Content-Disposition: attachment; filename=0001-Tests-for-array-copy.patch Content-Type: application/octet-stream; name="0001-Tests-for-array-copy.patch" Content-Transfer-Encoding: quoted-printable =46rom=20292014d961eca156afec7f97954c117916518aa3=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Llorens=20=0A= Date:=20Wed,=203=20Apr=202013=2022:31:47=20+0200=0ASubject:=20[PATCH=20= 1/3]=20Tests=20for=20array-copy!=0A=0A*=20test-suite/tests/arrays.test:=20= tests=20for=20arguments=20of=20rank=200,=201=20and=202.=0A---=0A=20= test-suite/tests/arrays.test=20|=2040=20= ++++++++++++++++++++++++++++++++++++++++=0A=201=20file=20changed,=2040=20= insertions(+)=0A=0Adiff=20--git=20a/test-suite/tests/arrays.test=20= b/test-suite/tests/arrays.test=0Aindex=20d88a1cb..7f1bbde=20100644=0A---=20= a/test-suite/tests/arrays.test=0A+++=20b/test-suite/tests/arrays.test=0A= @@=20-294,6=20+294,46=20@@=0A=20=20=20=20=20=20=20(pass-if=20"5/8"=20=20=20= =20(array-fill!=20a=205/8)=20=20=20=20#t))))=0A=20=0A=20;;;=0A+;;;=20= array-copy!=0A+;;;=0A+=0A+(with-test-prefix=20"array-copy!"=0A+=0A+=20=20= (with-test-prefix=20"rank=202"=0A+=20=20=20=20(pass-if=20(let=20((a=20= #2((1=202)=20(3=204)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(b=20(make-array=200=202=202))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(c=20(make-array=200=202=202))=0A+=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(d=20(make-array=200=202=20= 2))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(e=20= (make-array=200=202=202)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (array-copy!=20a=20b)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (array-copy!=20a=20(transpose-array=20c=201=200))=0A+=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(array-copy!=20(transpose-array=20a=201=200)=20= d)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(array-copy!=20= (transpose-array=20a=201=200)=20(transpose-array=20e=201=200))=0A+=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(and=20(equal?=20a=20#2((1=202)=20(3=20= 4)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (equal?=20b=20#2((1=202)=20(3=204)))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(equal?=20c=20#2((1=203)=20(2=204)))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(equal?=20d=20= #2((1=203)=20(2=204)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(equal?=20e=20#2((1=202)=20(3=204)))))))=0A+=0A+=20=20= (with-test-prefix=20"rank=201"=0A+=20=20=20=20(pass-if=20(let*=20((a=20= #2((1=202)=20(3=204)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(b=20(make-shared-array=20a=20(lambda=20(j)=20(list=201=20= j))=202))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (c=20(make-shared-array=20a=20(lambda=20(i)=20(list=20(-=201=20i)=201))=20= 2))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(d=20= (make-array=200=202))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(e=20(make-array=200=202)))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(array-copy!=20b=20d)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20(array-copy!=20c=20e)=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(and=20(equal?=20d=20#(3=204))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(equal?=20e=20#(4=202))))))=0A+=0A+=20=20= (with-test-prefix=20"rank=200"=0A+=20=20=20=20(pass-if=20(let=20((a=20= #0(99))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(b=20= (make-array=200)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (array-copy!=20a=20b)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (equal?=20b=20#0(99))))))=0A+=0A+=0A+;;;=0A=20;;;=20array-in-bounds?=0A=20= ;;;=0A=20=0A--=20=0A1.8.2=0A=0A= --Apple-Mail-187-168791434 Content-Disposition: attachment; filename=0002-Remove-double-indirection-in-array-fill.patch Content-Type: application/octet-stream; name="0002-Remove-double-indirection-in-array-fill.patch" Content-Transfer-Encoding: quoted-printable =46rom=2076432b25fda11957142e94653aafbc798ef4d880=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Llorens=20=0A= Date:=20Wed,=203=20Apr=202013=2022:40:40=20+0200=0ASubject:=20[PATCH=20= 2/3]=20Remove=20double=20indirection=20in=20array-fill!=0A=0A*=20= libguile/array-map.c:=20new=20function=20rafill,=20like=20= scm_array_fill_int,=0A=20=20but=20factors=20GVSET=20out=20of=20the=20= loop.=20Use=20it=20in=20scm_array_fill_x=20instead=20of=0A=20=20= scm_array_fill_int.=0A*=20test-suite/tests/arrays.test:=20add=20test=20= for=20array-fill!=20with=20stride=20!=3D=201.=0A---=0A=20= libguile/array-map.c=20=20=20=20=20=20=20=20=20|=2021=20= +++++++++++++++++++--=0A=20test-suite/tests/arrays.test=20|=2010=20= +++++++++-=0A=202=20files=20changed,=2028=20insertions(+),=203=20= deletions(-)=0A=0Adiff=20--git=20a/libguile/array-map.c=20= b/libguile/array-map.c=0Aindex=20b5b8cec..c86ea84=20100644=0A---=20= a/libguile/array-map.c=0A+++=20b/libguile/array-map.c=0A@@=20-318,6=20= +318,23=20@@=20scm_ramapc=20(void=20*cproc_ptr,=20SCM=20data,=20SCM=20= ra0,=20SCM=20lra,=20const=20char=20*what)=0A=20=20=20=20=20}=0A=20}=0A=20= =0A+static=20int=0A+rafill=20(SCM=20dst,=20SCM=20fill)=0A+{=0A+=20=20= long=20n=20=3D=20(SCM_I_ARRAY_DIMS=20(dst)->ubnd=20-=20SCM_I_ARRAY_DIMS=20= (dst)->lbnd=20+=201);=0A+=20=20scm_t_array_handle=20h;=0A+=20=20size_t=20= i;=0A+=20=20ssize_t=20inc;=0A+=20=20scm_generalized_vector_get_handle=20= (SCM_I_ARRAY_V=20(dst),=20&h);=0A+=20=20i=20=3D=20h.base=20+=20= h.dims[0].lbnd=20+=20SCM_I_ARRAY_BASE=20(dst)*h.dims[0].inc;=0A+=20=20= inc=20=3D=20SCM_I_ARRAY_DIMS=20(dst)->inc=20*=20h.dims[0].inc;=0A+=0A+=20= =20for=20(;=20n--=20>=200;=20i=20+=3D=20inc)=0A+=20=20=20=20h.impl->vset=20= (&h,=20i,=20fill);=0A+=0A+=20=20scm_array_handle_release=20(&h);=0A+=20=20= return=201;=0A+}=0A=20=0A=20SCM_DEFINE=20(scm_array_fill_x,=20= "array-fill!",=202,=200,=200,=0A=20=09=20=20=20=20(SCM=20ra,=20SCM=20= fill),=0A@@=20-325,14=20+342,14=20@@=20SCM_DEFINE=20(scm_array_fill_x,=20= "array-fill!",=202,=200,=200,=0A=20=09=20=20=20=20"returned=20is=20= unspecified.")=0A=20#define=20FUNC_NAME=20s_scm_array_fill_x=0A=20{=0A-=20= =20scm_ramapc=20(scm_array_fill_int,=20fill,=20ra,=20SCM_EOL,=20= FUNC_NAME);=0A+=20=20scm_ramapc=20(rafill,=20fill,=20ra,=20SCM_EOL,=20= FUNC_NAME);=0A=20=20=20return=20SCM_UNSPECIFIED;=0A=20}=0A=20#undef=20= FUNC_NAME=0A=20=0A=20/*=20to=20be=20used=20as=20cproc=20in=20scm_ramapc=20= to=20fill=20an=20array=20dimension=20with=0A=20=20=20=20"fill".=20*/=0A= -int=20=0A+int=0A=20scm_array_fill_int=20(SCM=20ra,=20SCM=20fill,=20SCM=20= ignore=20SCM_UNUSED)=0A=20#define=20FUNC_NAME=20s_scm_array_fill_x=0A=20= {=0Adiff=20--git=20a/test-suite/tests/arrays.test=20= b/test-suite/tests/arrays.test=0Aindex=207f1bbde..7b96b11=20100644=0A---=20= a/test-suite/tests/arrays.test=0A+++=20b/test-suite/tests/arrays.test=0A= @@=20-291,7=20+291,15=20@@=0A=20=20=20=20=20=20=20(pass-if=20"0"=20=20=20= =20=20=20(array-fill!=20a=200)=20=20=20=20=20=20#t)=0A=20=20=20=20=20=20=20= (pass-if=20"123"=20=20=20=20(array-fill!=20a=20123)=20=20=20=20#t)=0A=20=20= =20=20=20=20=20(pass-if=20"-123"=20=20=20(array-fill!=20a=20-123)=20=20=20= #t)=0A-=20=20=20=20=20=20(pass-if=20"5/8"=20=20=20=20(array-fill!=20a=20= 5/8)=20=20=20=20#t))))=0A+=20=20=20=20=20=20(pass-if=20"5/8"=20=20=20=20= (array-fill!=20a=205/8)=20=20=20=20#t)))=0A+=0A+=20=20(with-test-prefix=20= "noncompact"=0A+=20=20=20=20(let*=20((a=20(make-array=200=203=203))=0A+=20= =20=20=20=20=20=20=20=20=20=20(b=20(make-shared-array=20a=20(lambda=20= (i)=20(list=20i=20i))=203)))=0A+=20=20=20=20=20=20(array-fill!=20b=209)=0A= +=20=20=20=20=20=20(pass-if=0A+=20=20=20=20=20=20=20=20(and=20(equal?=20= b=20#(9=209=209))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(equal?=20a=20= #2((9=200=200)=20(0=209=200)=20(0=200=209))))))))=0A=20=0A=20;;;=0A=20= ;;;=20array-copy!=0A--=20=0A1.8.2=0A=0A= --Apple-Mail-187-168791434 Content-Disposition: attachment; filename=0003-Deprecate-scm_array_fill_int.patch Content-Type: application/octet-stream; name="0003-Deprecate-scm_array_fill_int.patch" Content-Transfer-Encoding: quoted-printable =46rom=20ef8e5b980c6d5a4dbea12fbed1ac7bc16277b859=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Llorens=20=0A= Date:=20Wed,=203=20Apr=202013=2022:52:21=20+0200=0ASubject:=20[PATCH=20= 3/3]=20Deprecate=20scm_array_fill_int()=0A=0A*=20libguile/array-map.h,=20= libgule/array-map.c:=20move=20scm_array_fill_int=0A=20=20to=20the=20= deprecated=20section.=0A---=0A=20doc/guile-api.alist=20=20|=20=201=20-=0A= =20libguile/array-map.c=20|=2041=20= ++++++++++++++++++++---------------------=0A=20libguile/array-map.h=20|=20= =202=20+-=0A=203=20files=20changed,=2021=20insertions(+),=2023=20= deletions(-)=0A=0Adiff=20--git=20a/doc/guile-api.alist=20= b/doc/guile-api.alist=0Aindex=205830c91..78d3a5c=20100644=0A---=20= a/doc/guile-api.alist=0A+++=20b/doc/guile-api.alist=0A@@=20-1359,7=20= +1359,6=20@@=0A=20(scm_array_copy_x=20(groups=20scm=20C)=20(scan-data=20= T))=0A=20(scm_array_dimensions=20(groups=20scm=20C)=20(scan-data=20T))=0A= =20(scm_array_equal_p=20(groups=20scm=20C)=20(scan-data=20T))=0A= -(scm_array_fill_int=20(groups=20scm=20C)=20(scan-data=20T))=0A=20= (scm_array_fill_x=20(groups=20scm=20C)=20(scan-data=20T))=0A=20= (scm_array_for_each=20(groups=20scm=20C)=20(scan-data=20T))=0A=20= (scm_array_identity=20(groups=20scm=20C)=20(scan-data=20T))=0Adiff=20= --git=20a/libguile/array-map.c=20b/libguile/array-map.c=0Aindex=20= c86ea84..2779458=20100644=0A---=20a/libguile/array-map.c=0A+++=20= b/libguile/array-map.c=0A@@=20-347,26=20+347,6=20@@=20SCM_DEFINE=20= (scm_array_fill_x,=20"array-fill!",=202,=200,=200,=0A=20}=0A=20#undef=20= FUNC_NAME=0A=20=0A-/*=20to=20be=20used=20as=20cproc=20in=20scm_ramapc=20= to=20fill=20an=20array=20dimension=20with=0A-=20=20=20"fill".=20*/=0A= -int=0A-scm_array_fill_int=20(SCM=20ra,=20SCM=20fill,=20SCM=20ignore=20= SCM_UNUSED)=0A-#define=20FUNC_NAME=20s_scm_array_fill_x=0A-{=0A-=20=20= unsigned=20long=20i;=0A-=20=20unsigned=20long=20n=20=3D=20= SCM_I_ARRAY_DIMS=20(ra)->ubnd=20-=20SCM_I_ARRAY_DIMS=20(ra)->lbnd=20+=20= 1;=0A-=20=20long=20inc=20=3D=20SCM_I_ARRAY_DIMS=20(ra)->inc;=0A-=20=20= unsigned=20long=20base=20=3D=20SCM_I_ARRAY_BASE=20(ra);=0A-=0A-=20=20ra=20= =3D=20SCM_I_ARRAY_V=20(ra);=0A-=0A-=20=20for=20(i=20=3D=20base;=20n--;=20= i=20+=3D=20inc)=0A-=20=20=20=20GVSET=20(ra,=20i,=20fill);=0A-=0A-=20=20= return=201;=0A-}=0A-#undef=20FUNC_NAME=0A-=0A=20=0A=20static=20int=0A=20= racp=20(SCM=20src,=20SCM=20dst)=0A@@=20-411,10=20+391,29=20@@=20= SCM_DEFINE=20(scm_array_copy_x,=20"array-copy!",=202,=200,=200,=0A=20}=0A= =20#undef=20FUNC_NAME=0A=20=0A-/*=20Functions=20callable=20by=20= ARRAY-MAP!=20*/=0A=20=0A=20#if=20SCM_ENABLE_DEPRECATED=20=3D=3D=201=0A=20= =0A+/*=20to=20be=20used=20as=20cproc=20in=20scm_ramapc=20to=20fill=20an=20= array=20dimension=20with=0A+=20=20=20"fill".=20*/=0A+int=0A= +scm_array_fill_int=20(SCM=20ra,=20SCM=20fill,=20SCM=20ignore=20= SCM_UNUSED)=0A+{=0A+=20=20unsigned=20long=20i;=0A+=20=20unsigned=20long=20= n=20=3D=20SCM_I_ARRAY_DIMS=20(ra)->ubnd=20-=20SCM_I_ARRAY_DIMS=20= (ra)->lbnd=20+=201;=0A+=20=20long=20inc=20=3D=20SCM_I_ARRAY_DIMS=20= (ra)->inc;=0A+=20=20unsigned=20long=20base=20=3D=20SCM_I_ARRAY_BASE=20= (ra);=0A+=0A+=20=20ra=20=3D=20SCM_I_ARRAY_V=20(ra);=0A+=0A+=20=20for=20= (i=20=3D=20base;=20n--;=20i=20+=3D=20inc)=0A+=20=20=20=20GVSET=20(ra,=20= i,=20fill);=0A+=0A+=20=20return=201;=0A+}=0A+=0A+/*=20Functions=20= callable=20by=20ARRAY-MAP!=20*/=0A+=0A=20int=0A=20scm_ra_eqp=20(SCM=20= ra0,=20SCM=20ras)=0A=20{=0Adiff=20--git=20a/libguile/array-map.h=20= b/libguile/array-map.h=0Aindex=20eb1aa37..b0592d8=20100644=0A---=20= a/libguile/array-map.h=0A+++=20b/libguile/array-map.h=0A@@=20-31,7=20= +31,6=20@@=0A=20SCM_API=20int=20scm_ra_matchp=20(SCM=20ra0,=20SCM=20= ras);=0A=20SCM_API=20int=20scm_ramapc=20(void=20*cproc,=20SCM=20data,=20= SCM=20ra0,=20SCM=20lra,=0A=20=09=09=09const=20char=20*what);=0A-SCM_API=20= int=20scm_array_fill_int=20(SCM=20ra,=20SCM=20fill,=20SCM=20ignore);=0A=20= SCM_API=20SCM=20scm_array_fill_x=20(SCM=20ra,=20SCM=20fill);=0A=20= SCM_API=20SCM=20scm_array_copy_x=20(SCM=20src,=20SCM=20dst);=0A=20= SCM_API=20SCM=20scm_array_map_x=20(SCM=20ra0,=20SCM=20proc,=20SCM=20= lra);=0A@@=20-42,6=20+41,7=20@@=20SCM_INTERNAL=20void=20= scm_init_array_map=20(void);=0A=20=0A=20#if=20SCM_ENABLE_DEPRECATED=20=3D=3D= =201=0A=20=0A+SCM_DEPRECATED=20int=20scm_array_fill_int=20(SCM=20ra,=20= SCM=20fill,=20SCM=20ignore);=0A=20SCM_DEPRECATED=20int=20scm_ra_eqp=20= (SCM=20ra0,=20SCM=20ras);=0A=20SCM_DEPRECATED=20int=20scm_ra_lessp=20= (SCM=20ra0,=20SCM=20ras);=0A=20SCM_DEPRECATED=20int=20scm_ra_leqp=20(SCM=20= ra0,=20SCM=20ras);=0A--=20=0A1.8.2=0A=0A= --Apple-Mail-187-168791434--