Welcome to the CHICKEN Scheme pasting service

array map vs. raw vector-map added by DeeEff on Sat Sep 9 00:16:45 2017

#;1> (use generalized-arrays storage-classes srfi-133)
; loading ./generalized-arrays.import.scm ...
; loading /opt/chicken-4.12.0//lib/chicken/8/srfi-1.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/srfi-4.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/srfi-133.import.so ...
; loading ./storage-classes.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/numbers.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/typed-records.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/defstruct.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/type-stubs.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/type-checks.import.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/type-errors.import.so ...

Note: re-importing already imported identifier: vector-fill!

Note: re-importing already imported identifier: vector-copy!

Note: re-importing already imported identifier: vector->list

Note: re-importing already imported identifier: list->vector
; loading ./generalized-arrays.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/srfi-133.so ...
; loading ./storage-classes.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/numbers.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/typed-records.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/type-checks.so ...
; loading /opt/chicken-4.12.0//lib/chicken/8/type-errors.so ...
#;2> (define vv (make-array vector-storage-class #(500 500) 1))
#;3> (define ss (array-storage-object vv))
#;4> (time (array-map vector-storage-class (lambda (x) (* x 999)) vv))
0.304s CPU time, 0.008s GC time (major), 5441/903 mutations (total/tracked), 1/1406 GCs (major/minor), maximum live heap: 2.38 MiB
#<array>
#;5> (time (vector-map (lambda (x) (* x 999)) ss))
0.248s CPU time, 4515/750 mutations (total/tracked), 0/1147 GCs (major/minor), maximum live heap: 3.33 MiB

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Type in the text below:
 _      _     _ _     
(_)_ __(_) __| | |__  
| | '__| |/ _` | '_ \ 
| | |  | | (_| | |_) |
|_|_|  |_|\__,_|_.__/ 
                      
Visually impaired? Let me spell it for you (wav file) download WAV