2009-04-26 14:31:10 -04:00
|
|
|
! Copyright (C) 2009 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
|
|
|
USING: kernel math math.functions tuple-arrays accessors fry sequences
|
|
|
|
prettyprint ;
|
|
|
|
IN: benchmark.tuple-arrays
|
|
|
|
|
|
|
|
TUPLE: point { x float } { y float } { z float } ;
|
|
|
|
|
|
|
|
TUPLE-ARRAY: point
|
|
|
|
|
|
|
|
: tuple-array-benchmark ( -- )
|
|
|
|
100 [
|
|
|
|
drop 5000 <point-array> [
|
2009-08-13 20:21:44 -04:00
|
|
|
[ 1 + ] change-x
|
|
|
|
[ 1 - ] change-y
|
|
|
|
[ 1 + 2 / ] change-z
|
2009-10-29 15:34:04 -04:00
|
|
|
] map [ z>> ] map-sum
|
|
|
|
] map-sum . ;
|
2009-04-26 14:31:10 -04:00
|
|
|
|
2009-08-13 20:21:44 -04:00
|
|
|
MAIN: tuple-array-benchmark
|