mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
Speed up for multi-arg cases of scm_ramap functions
This patch results in a 20%-40% speedup in the > 1 argument cases of the following microbenchmarks: (define A (make-shared-array #0(1) (const '()) #e1e7)) ; 1, 2, 3 arguments. (define a 0) ,time (array-for-each (lambda (b) (set! a (+ a b))) A) (define a 0) ,time (array-for-each (lambda (b c) (set! a (+ a b c))) A A) (define a 0) ,time (array-for-each (lambda (b c d) (set! a (+ a b c d))) A A A) (define A (make-shared-array (make-array 1) (const '()) #e1e7)) (define B (make-shared-array #0(1) (const '()) #e1e7)) ; 1, 2, 3 arguments. ,time (array-map! A + B) ,time (array-map! A + B B) ,time (array-map! A + B B B) * libguile/array-map.c (scm_ramap): note on cproc arguments. (rafill): assume that dst's lbnd is 0. (racp): assume that src's lbnd is 0. (ramap): assume that ra0's lbnd is 0. When there're more than two arguments, compute the array handles before the loop. Allocate the arg list once and reuse it in the loop. (rafe): like rafe, when there's more than one argument. (AREF, ASET): remove.
This commit is contained in:
parent
348d8b46b0
commit
c17799dda9
3 changed files with 86 additions and 77 deletions
|
@ -4,7 +4,7 @@
|
|||
#define SCM_ARRAY_MAP_H
|
||||
|
||||
/* Copyright (C) 1995, 1996, 1997, 2000, 2006, 2008, 2009, 2010,
|
||||
* 2011, 2013 Free Software Foundation, Inc.
|
||||
* 2011, 2013, 2015 Free Software Foundation, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue