Re: array-copy! is slow & array-map.c

2013-04-07 Thread Ludovic Courtès
Daniel Llorens skribis: > From 70fec2abb32b5d2546a40c70d15526b0ee5ccc20 Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Sun, 7 Apr 2013 00:04:35 +0200 > Subject: [PATCH] Don't use scm_generalized_vector_get_handle() in array-map.c > > * libguile/array-map.c: (rafill, racp, ramap, rafe):

Re: array-copy! is slow & array-map.c

2013-04-07 Thread Daniel Llorens
This patch replaces the scm_generalized_vector_get_handle() in the rank-1 functions by scm_array_get_handle(). These calls came from the GVSET/GVREF code that I spliced in there, but the arguments are known to be rank-1, so there's no reason not to use the simpler call. Regards Danie

Fwd: array-copy! is slow & array-map.c

2013-04-06 Thread Daniel Llorens
This patch replaces the scm_generalized_vector_get_handle() in the rank-1 functions by scm_array_get_handle(). These calls came from the GVSET/GVREF code that I spliced in there, but the arguments are known to be rank-1, so there's no reason not to use the simpler call. Regards Danie

Re: array-copy! is slow & array-map.c

2013-04-05 Thread Ludovic Courtès
Daniel Llorens skribis: > From 76432b25fda11957142e94653aafbc798ef4d880 Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Wed, 3 Apr 2013 22:40:40 +0200 > Subject: [PATCH 2/3] Remove double indirection in array-fill! > > * libguile/array-map.c: new function rafill, like scm_array_fill_int,

Re: array-copy! is slow & array-map.c

2013-04-05 Thread Ludovic Courtès
Daniel Llorens skribis: > Like this? Yes, thanks. Ludo'.

Re: array-copy! is slow & array-map.c

2013-04-05 Thread Daniel Llorens
On Apr 5, 2013, at 19:20, Ludovic Courtès wrote: > Daniel Llorens skribis: > >> +(with-test-prefix "array-copy!" >> + >> + (with-test-prefix "rank 2" >> +(pass-if (let ((a #2((1 2) (3 4))) >> + (b (make-array 0 2 2)) > > Can you make that: > > (with-test-prefix "array-

Re: array-copy! is slow & array-map.c

2013-04-05 Thread Ludovic Courtès
Daniel Llorens skribis: > +(with-test-prefix "array-copy!" > + > + (with-test-prefix "rank 2" > +(pass-if (let ((a #2((1 2) (3 4))) > + (b (make-array 0 2 2)) Can you make that: (with-test-prefix "array-copy!" (pass-if "rank 2" (let ((a ... (Same for the

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Daniel Llorens
Attached 1st a patch with some array-copy! tests, then the array-fill! patch split in two parts. Thanks! Daniel 0001-Tests-for-array-copy.patch Description: Binary data 0002-Remove-double-indirection-in-array-fill.patch Description: Binary data 0003-Deprecate-scm_array_fill_int.p

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Daniel Llorens skribis: > From 03aa7ea2e61b419d38c6ca8de75ee34e5b55d28a Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Wed, 3 Apr 2013 16:19:17 +0200 > Subject: [PATCH 5/5] Remove double indirection in array-fill! > > * libguile/array-map.c, libguile/array-map.c: deprecate scm_array_fil

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Daniel Llorens skribis: > From 0392b6ceab229d8d6546e1ff79e38d3c11881e04 Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Tue, 2 Apr 2013 16:43:37 +0200 > Subject: [PATCH 4/5] Remove double indirection for 1st arg of array-for-each > > * libguile/array-map.c: (rafe): factor GVREF out of ra

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Daniel Llorens
On Apr 3, 2013, at 19:06, Ludovic Courtès wrote: > Daniel Llorens skribis: > >> From eb4bbb3f42a4a0fcf1d51ecacd557606533d5b40 Mon Sep 17 00:00:00 2001 >> From: Daniel Llorens >> Date: Tue, 2 Apr 2013 15:23:55 +0200 >> Subject: [PATCH 2/5] Avoid per-element cons for 1-arg case of array-map! >>

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Daniel Llorens skribis: > From 78322cca895275772028bebeb79ac5038df04047 Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Tue, 2 Apr 2013 15:53:22 +0200 > Subject: [PATCH 3/5] Remove double indirection in array-map! with <2 args > > * libguile/array-map.c: (ramap): factor GVSET/GVREF out o

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Daniel Llorens skribis: > From eb4bbb3f42a4a0fcf1d51ecacd557606533d5b40 Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Tue, 2 Apr 2013 15:23:55 +0200 > Subject: [PATCH 2/5] Avoid per-element cons for 1-arg case of array-map! > > * libguile/array-map.c: (ramap): special case when ras is

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Daniel Llorens skribis: > From 3fba07976ac26b7e7def16679a7e7d1f92b2951c Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Wed, 3 Apr 2013 15:40:48 +0200 > Subject: [PATCH 1/5] Deprecate dead code in array-map.c > > * libguile/array-map.c, libguile/array-map.h: deprecate scm_ra_eqp, > scm

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Daniel Llorens
On Apr 3, 2013, at 14:50, Ludovic Courtès wrote: > Daniel Llorens skribis: > >> These two patches do it for array-map!. >> >> The first patch avoids cons for the 1-argument case. The second patch >> removes the double indirection for the first two arguments in every case. >> Since there's so

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Daniel Llorens skribis: > These two patches do it for array-map!. > > The first patch avoids cons for the 1-argument case. The second patch removes > the double indirection for the first two arguments in every case. Since > there's some work done inside the loop, the improvement is smaller than

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Daniel Llorens skribis: > From a38b0a98ed6093ee9ebe4ac60b4b6f9efbdcfdd5 Mon Sep 17 00:00:00 2001 > From: Daniel Llorens > Date: Mon, 1 Apr 2013 18:43:58 +0200 > Subject: [PATCH 2/2] Remove double indirection in element access in > array-copy! > > * libguile/array-map.c: (racp): factor scm_gener

Re: array-copy! is slow & array-map.c

2013-04-03 Thread Ludovic Courtès
Hi Daniel, Daniel Llorens skribis: > --- a/libguile/array-map.h > +++ b/libguile/array-map.h > @@ -34,16 +34,6 @@ SCM_API int scm_ramapc (void *cproc, SCM data, SCM ra0, > SCM lra, > SCM_API int scm_array_fill_int (SCM ra, SCM fill, SCM ignore); > SCM_API SCM scm_array_fill_x (SCM ra, SCM fil

Re: array-copy! is slow & array-map.c (was: Extremly slow for format & string-join)

2013-04-02 Thread Daniel Llorens
Hello, sorry for the repeated message earlier. Ok, i think it's clear that all these double indirections can be eliminated globally by composing the strides of the array descriptor with the stride of SCM_I_ARRAY_V (array) and using that directly in the array descriptor. Is there any reason n

Re: array-copy! is slow & array-map.c (was: Extremly slow for format & string-join)

2013-04-02 Thread Daniel Llorens
This patch is for array-for-each. Only the first argument. Before: scheme@(guile-user)> (define a (make-array 1 100 10)) scheme@(guile-user)> ,time (let ((x 0)) (array-for-each (lambda (a) (set! x (+ a x))) a) x) $8 = 1000 ;; 0.621887s real time, 0.620181s run time. 0.00s spent in

Re: array-copy! is slow & array-map.c (was: Extremly slow for format & string-join)

2013-04-02 Thread Daniel Llorens
On Apr 2, 2013, at 12:19, Daniel Llorens wrote: > On Apr 1, 2013, at 19:15, Daniel Llorens wrote: > >> Third, none of the above are causing the slowness of array-copy!. I noticed >> that there's a double indirection in racp(). The second patch removes it. >> Actually this double indirection go

Re: array-copy! is slow & array-map.c (was: Extremly slow for format & string-join)

2013-04-02 Thread Daniel Llorens
On Apr 2, 2013, at 12:19, Daniel Llorens wrote: > On Apr 1, 2013, at 19:15, Daniel Llorens wrote: > >> Third, none of the above are causing the slowness of array-copy!. I noticed >> that there's a double indirection in racp(). The second patch removes it. >> Actually this double indirection go

Re: array-copy! is slow & array-map.c (was: Extremly slow for format & string-join)

2013-04-02 Thread Daniel Llorens
On Apr 1, 2013, at 19:15, Daniel Llorens wrote: > Third, none of the above are causing the slowness of array-copy!. I noticed > that there's a double indirection in racp(). The second patch removes it. > Actually this double indirection goes on all over array-map.c and I don't > understand why

array-copy! is slow & array-map.c (was: Extremly slow for format & string-join)

2013-04-01 Thread Daniel Llorens
> Message: 5 > Date: Mon, 1 Apr 2013 15:40:48 +0800 > From: Daniel Hartwig > To: guile-devel@gnu.org > Subject: Re: Extremly slow for format & string-join > On 1 April 2013 14:59, Daniel Llorens wrote: >> How can it be slower to allocate the result at once? > > Shrug. I do not know much of a