]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/tuple-arrays/tuple-arrays.factor
483311d4f4c9d7fed812fc892ef89c0213b33036
[factor.git] / extra / benchmark / tuple-arrays / tuple-arrays.factor
1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel math math.functions tuple-arrays accessors fry sequences
4 prettyprint ;
5 IN: benchmark.tuple-arrays
6
7 TUPLE: point { x float } { y float } { z float } ;
8
9 TUPLE-ARRAY: point
10
11 : tuple-array-benchmark ( -- )
12     100 [
13         drop 5000 <point-array> [
14             [ 1+ ] change-x
15             [ 1- ] change-y
16             [ 1+ 2 / ] change-z
17         ] map [ z>> ] sigma
18     ] sigma . ;
19
20 MAIN: tuple-array-benchmark