unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Daniel Llorens <daniel.llorens@bluewin.ch>
To: "Ludovic Courtès" <ludo@gnu.org>
Subject: Re: array-copy! is slow & array-map.c
Date: Sun, 7 Apr 2013 00:59:43 +0200	[thread overview]
Message-ID: <81C95CA4-BD83-4DF6-B389-4610623DDE54@bluewin.ch> (raw)
In-Reply-To: <87txnk90kp.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]


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

	Daniel


[-- Attachment #2: 0001-Don-t-use-scm_generalized_vector_get_handle-in-array.patch --]
[-- Type: application/octet-stream, Size: 2714 bytes --]

From 70fec2abb32b5d2546a40c70d15526b0ee5ccc20 Mon Sep 17 00:00:00 2001
From: Daniel Llorens <daniel.llorens@bluewin.ch>
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): use
  scm_array_get_handle() instead of scm_generalized_get_vector_handle().
---
 libguile/array-map.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libguile/array-map.c b/libguile/array-map.c
index 2779458..1c443ac 100644
--- a/libguile/array-map.c
+++ b/libguile/array-map.c
@@ -325,7 +325,7 @@ rafill (SCM dst, SCM fill)
   scm_t_array_handle h;
   size_t i;
   ssize_t inc;
-  scm_generalized_vector_get_handle (SCM_I_ARRAY_V (dst), &h);
+  scm_array_get_handle (SCM_I_ARRAY_V (dst), &h);
   i = h.base + h.dims[0].lbnd + SCM_I_ARRAY_BASE (dst)*h.dims[0].inc;
   inc = SCM_I_ARRAY_DIMS (dst)->inc * h.dims[0].inc;
 
@@ -357,8 +357,8 @@ racp (SCM src, SCM dst)
   ssize_t inc_s, inc_d;
 
   dst = SCM_CAR (dst);
-  scm_generalized_vector_get_handle (SCM_I_ARRAY_V (src), &h_s);
-  scm_generalized_vector_get_handle (SCM_I_ARRAY_V (dst), &h_d);
+  scm_array_get_handle (SCM_I_ARRAY_V (src), &h_s);
+  scm_array_get_handle (SCM_I_ARRAY_V (dst), &h_d);
 
   i_s = h_s.base + h_s.dims[0].lbnd + SCM_I_ARRAY_BASE (src) * h_s.dims[0].inc;
   i_d = h_d.base + h_d.dims[0].lbnd + SCM_I_ARRAY_BASE (dst) * h_d.dims[0].inc;
@@ -665,7 +665,7 @@ ramap (SCM ra0, SCM proc, SCM ras)
   scm_t_array_handle h0;
   size_t i0, i0end;
   ssize_t inc0;
-  scm_generalized_vector_get_handle (SCM_I_ARRAY_V (ra0), &h0);
+  scm_array_get_handle (SCM_I_ARRAY_V (ra0), &h0);
   i0 = h0.base + h0.dims[0].lbnd + SCM_I_ARRAY_BASE (ra0)*h0.dims[0].inc;
   inc0 = SCM_I_ARRAY_DIMS (ra0)->inc * h0.dims[0].inc;
   i0end = i0 + n*inc0;
@@ -678,7 +678,7 @@ ramap (SCM ra0, SCM proc, SCM ras)
       scm_t_array_handle h1;
       size_t i1;
       ssize_t inc1;
-      scm_generalized_vector_get_handle (SCM_I_ARRAY_V (ra1), &h1);
+      scm_array_get_handle (SCM_I_ARRAY_V (ra1), &h1);
       i1 = h1.base + h1.dims[0].lbnd + SCM_I_ARRAY_BASE (ra1)*h1.dims[0].inc;
       inc1 = SCM_I_ARRAY_DIMS (ra1)->inc * h1.dims[0].inc;
       ras = SCM_CDR (ras);
@@ -738,7 +738,7 @@ rafe (SCM ra0, SCM proc, SCM ras)
   scm_t_array_handle h0;
   size_t i0, i0end;
   ssize_t inc0;
-  scm_generalized_vector_get_handle (SCM_I_ARRAY_V (ra0), &h0);
+  scm_array_get_handle (SCM_I_ARRAY_V (ra0), &h0);
   i0 = h0.base + h0.dims[0].lbnd + SCM_I_ARRAY_BASE (ra0)*h0.dims[0].inc;
   inc0 = SCM_I_ARRAY_DIMS (ra0)->inc * h0.dims[0].inc;
   i0end = i0 + n*inc0;
-- 
1.8.2


  reply	other threads:[~2013-04-06 22:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1257718.1364809945.854.guile-devel@gnu.org>
2013-04-01 17:15 ` array-copy! is slow & array-map.c (was: Extremly slow for format & string-join) Daniel Llorens
2013-04-02 10:19   ` Daniel Llorens
2013-04-02 14:06     ` Daniel Llorens
2013-04-03 12:50       ` array-copy! is slow & array-map.c Ludovic Courtès
2013-04-03 14:50         ` Daniel Llorens
2013-04-03 17:03           ` Ludovic Courtès
2013-04-03 17:06           ` Ludovic Courtès
2013-04-03 17:59             ` Daniel Llorens
2013-04-03 17:07           ` Ludovic Courtès
2013-04-03 19:36           ` Ludovic Courtès
     [not found]             ` <ECA152EF-A180-45EF-9E8F-D40DD28A2779@jast.ch>
     [not found]               ` <87mwtfmlap.fsf@gnu.org>
2013-04-03 21:04                 ` Daniel Llorens
2013-04-05 17:20                   ` Ludovic Courtès
2013-04-05 17:29                     ` Daniel Llorens
2013-04-05 20:32                       ` Ludovic Courtès
2013-04-05 20:36                   ` Ludovic Courtès
2013-04-06 22:59                     ` Daniel Llorens [this message]
2013-04-06 23:01                       ` Fwd: " Daniel Llorens
2013-04-07  9:18                       ` Ludovic Courtès
2013-04-03 19:42           ` Ludovic Courtès
2013-04-02 14:55     ` array-copy! is slow & array-map.c (was: Extremly slow for format & string-join) Daniel Llorens
2013-04-02 14:57       ` Daniel Llorens
2013-04-02 15:14       ` Daniel Llorens
2013-04-03 12:05   ` array-copy! is slow & array-map.c Ludovic Courtès
2013-04-03 12:23   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81C95CA4-BD83-4DF6-B389-4610623DDE54@bluewin.ch \
    --to=daniel.llorens@bluewin.ch \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).