]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/tuple-arrays/tuple-arrays.factor
0f5313b41e2ce2e8606fd83ac139a0a3f29da821
[factor.git] / extra / benchmark / tuple-arrays / tuple-arrays.factor
1 ! Copyright (C) 2009, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors kernel math sequences tuple-arrays ;
4 IN: benchmark.tuple-arrays
5
6 TUPLE: point { x float } { y float } { z float } ; final
7
8 TUPLE-ARRAY: point
9
10 : tuple-arrays-benchmark ( -- )
11     1,000 iota [
12         drop 5,000 <point-array> [
13             [ 1 + ] change-x
14             [ 1 - ] change-y
15             [ 1 + 2 / ] change-z
16         ] map [ z>> ] map-sum
17     ] map-sum 0x1.312dp21 assert= ;
18
19 MAIN: tuple-arrays-benchmark