diff options
author | Daniel Llorens <daniel.llorens@bluewin.ch> | 2015-02-13 18:42:27 +0100 |
---|---|---|
committer | Daniel Llorens <daniel.llorens@bluewin.ch> | 2016-11-23 11:49:35 +0100 |
commit | 31e9f8b974073e690f1ba6c60e18ed474de004a1 (patch) | |
tree | 1e136c9399c93c591dec6bf161d9b8fa102c46ad /test-suite | |
parent | fa40c288caca1b1fe7630621bd5c55574514588a (diff) |
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): Do as in ramap(), when there's more than one argument.
(AREF, ASET): Remove.
Diffstat (limited to 'test-suite')
-rw-r--r-- | test-suite/tests/ramap.test | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test-suite/tests/ramap.test b/test-suite/tests/ramap.test index c8eaf96eb..bd8a434bd 100644 --- a/test-suite/tests/ramap.test +++ b/test-suite/tests/ramap.test @@ -453,11 +453,11 @@ (with-test-prefix "3 sources" (pass-if-equal "noncompact arrays 1" - '((3 3 3) (2 2 2)) + '((3 1 3) (2 0 2)) (let* ((a #2((0 1) (2 3))) (l '()) (rec (lambda args (set! l (cons args l))))) - (array-for-each rec (array-row a 1) (array-row a 1) (array-row a 1)) + (array-for-each rec (array-row a 1) (array-row a 0) (array-row a 1)) l)) (pass-if-equal "noncompact arrays 2" |