1 ! Copyright (C) 2019 HMC Clinic.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: arrays kernel locals math math.functions math.statistics memory
7 ! puts items from els (a quotation) on stack, runs ops (a quot w no stack effect) n times
8 ! returns an array with times (ns) for each trial
9 :: benchmark-multiple ( els: ( -- .. ) op: ( .. -- .. ) n -- ..arr )
15 n [ gc [ op benchmark ] dip arr set-nth ] each-integer
19 ! finds the confidence interval of seq with significance level 95
20 :: confidence-interval ( seq -- {c1,c2} )
22 ! HARDCODING ALERT: z value for alpha = 95 is 1.96
25 seq length sqrt / :> modifier