]> gitweb.factorcode.org Git - factor.git/commitdiff
benchmark.sum-file: simpler, more idiomatic, faster.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 8 Apr 2013 14:17:37 +0000 (07:17 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 8 Apr 2013 14:17:37 +0000 (07:17 -0700)
extra/benchmark/sum-file/sum-file.factor

index e1ce2b76fbe5215d21a7ec287e3c5ebdfe90846a..b7b37d09b698d85c7a8f69a871f01f8200ac1a68 100644 (file)
@@ -8,11 +8,8 @@ IN: benchmark.sum-file
 ] with-file-writer
 >>
 
-: sum-file-loop ( n -- n' )
-    readln [ string>number + sum-file-loop ] when* ;
-
 : sum-file ( file -- n )
-    ascii [ 0 sum-file-loop ] with-file-reader ;
+    ascii [ 0 [ string>number + ] each-line ] with-file-reader ;
 
 : sum-file-benchmark ( -- )
     15 [