1 ! Copyright (c) 2007, 2008 Aaron Schaefer.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: combinators.smart formatting fry io kernel macros math
4 math.functions math.statistics memory sequences tools.time ;
5 IN: project-euler.ave-time
7 MACRO: collect-benchmarks ( quot n -- seq )
8 swap '[ _ [ [ [ _ nullary ] preserving ] gc benchmark 1000 / ] replicate ] ;
10 : ave-time ( quot n -- )
13 [ mean round >integer ]
16 "%d ms ave run time - %.2f SD (%d trials)\n" printf flush ; inline