Hi!

Currently, "timeit" often does not more than finding the "best of
three". I suspect that computing a standard deviation from just three
samples is not quite reliable. Hence, if one wants to get a statistic
then one needs a lot more runs, thus, the test will take much more
time.

Do we want that "timeit" will take much more time *by default*?

Perhaps one could keep "timeit" as it is and introduce a new object
"time_statistics" (say), that collects timings and may add additional
data points, if the user so wish?

For example:

sage: s="some code to be tested"
sage: TS = time_statistics(s, number=10000)
sage: TS
10000 runs per sample
3 samples in total
Mean: 451 ns
Standard deviation: 103 ns

The parameter "number" is supposed to have the same meaning (and the
same default) as for timeit: It is the number of repetitions of the
code string forming one data point.

Since three samples (or whatever the default should be) is not enough,
we wish to add samples:

sage: TS.additional_samples(15)
sage: TS
10000 runs per sample
18 samples in total
Mean: 446 ns
Standard deviation:  17 ns

And of course TS has methods returning these (and other) statistical
data.

I guess that is similar to what William is suggesting for the "timeit"
command; but I think "timeit" (for fast tests) and
"time_statistics" (for detailed but more time consuming tests) should
be separated.

Cheers,
Simon

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to