]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/sum-file/sum-file.factor
core: Rename iota to <iota> so we can have TUPLE: iota ... ; instead of TUPLE: iota...
[factor.git] / extra / benchmark / sum-file / sum-file.factor
1 USING: io io.encodings.ascii io.files io.files.temp math
2 math.parser kernel sequences ;
3 IN: benchmark.sum-file
4
5 <<
6 "sum-file.txt" temp-file ascii [
7     100000 <iota> [ number>string print ] each
8 ] with-file-writer
9 >>
10
11 : sum-file ( file -- n )
12     ascii [ 0 [ string>number + ] each-line ] with-file-reader ;
13
14 : sum-file-benchmark ( -- )
15     15 [
16         "sum-file.txt" temp-file sum-file 4999950000 assert=
17     ] times ;
18
19 MAIN: sum-file-benchmark