]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/benchmark/struct-arrays/struct-arrays.factor
Specialized array overhaul
[factor.git] / extra / benchmark / struct-arrays / struct-arrays.factor
index faed2f4dcad3f02e9ec093aacd459fbfbf8baf02..799ef2d46760342d9535295a00cb4d763ad0dead 100644 (file)
@@ -2,11 +2,13 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors classes.struct combinators.smart fry kernel
 math math.functions math.order math.parser sequences
-struct-arrays io ;
+specialized-arrays io ;
 IN: benchmark.struct-arrays
 
 STRUCT: point { x float } { y float } { z float } ;
 
+SPECIALIZED-ARRAY: point
+
 : xyz ( point -- x y z )
     [ x>> ] [ y>> ] [ z>> ] tri ; inline
 
@@ -19,7 +21,7 @@ STRUCT: point { x float } { y float } { z float } ;
     1 + ; inline
 
 : make-points ( len -- points )
-    point <struct-array> dup 0 [ init-point ] reduce drop ; inline
+    <point-array> dup 0 [ init-point ] reduce drop ; inline
 
 : point-norm ( point -- norm )
     [ xyz [ absq ] tri@ ] sum-outputs sqrt ; inline