[Tutor] Astonishing timing result
Kent Johnson
kent37 at tds.net
Wed Jun 25 18:56:22 CEST 2008
On Wed, Jun 25, 2008 at 12:05 PM, Lie Ryan <lie.1296 at gmail.com> wrote:
> t_a = min(t_A, t_a)
> t_b = min(t_A, t_b)
> t_c = min(t_A, t_c)
> t_d = min(t_A, t_d)
What is this for? It should at least be t_B, t_C, t_D.
> ## OUTPUT
> # 1.02956604958
> # 1.02956604958
> # 1.02956604958
> # 1.02956604958
It's *very easy* to write bogus timing tests, as this thread
demonstrates. Some protections:
- when comparing different implementations of a function, make sure
each implementation returns the correct result by checking the return
value. You probably want to make this check outside the actual timing
test.
- when your results don't make sense, suspect your tests.
Kent
Kent
More information about the Tutor
mailing list