]> gitweb.factorcode.org Git - factor.git/commitdiff
vectors: small speedup to ``f ?push`` and inline 1vector.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 12 May 2014 16:07:19 +0000 (09:07 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 12 May 2014 16:07:19 +0000 (09:07 -0700)
core/vectors/vectors.factor

index c1bffbb9a10e1e005a82d70532f7c5cc1f5299bb..27cd1cf734537c0c756f2fcb8a8b34b6e6b7a102 100644 (file)
@@ -40,7 +40,7 @@ M: sequence new-resizable drop <vector> ; inline
 
 INSTANCE: vector growable
 
-: 1vector ( x -- vector ) V{ } 1sequence ;
+: 1vector ( x -- vector ) 1array 1 vector boa ; inline
 
 : ?push ( elt seq/f -- seq )
-    [ 1 <vector> ] unless* [ push ] keep ;
+    [ [ push ] keep ] [ 1vector ] if* ;