generate De Bruijn sequence memory and string vs lists

Vincent Davis vincent at vincentdavis.net
Thu Jan 23 17:55:01 EST 2014


On Thu, Jan 23, 2014 at 3:15 PM, Peter Otten <__peter__ at web.de> wrote:

> $ python -m timeit -s 'from debruijn_compat import debruijn as d' 'd(4, 8)'
> 10 loops, best of 3: 53.5 msec per loop
> $ python -m timeit -s 'from debruijn_compat import debruijn_bytes as d'
> 'd(4, 8)'
> 10 loops, best of 3: 22.2 msec per loop
> $ python3 -m timeit -s 'from debruijn_compat import debruijn as d' 'd(4,
> 8)'
> 10 loops, best of 3: 68 msec per loop
> $ python3 -m timeit -s 'from debruijn_compat import debruijn_bytes as d'
> 'd(4, 8)'
> 10 loops, best of 3: 21.7 msec per loop
>

Excellent Peter!
I have a question, the times reported don't make sense to me, for example
$ python3 -m timeit -s 'from debruijn_compat import debruijn_bytes as d'
'd(4, 8)'
100 loops, best of 3: 10.2 msec per loop
This took ~4 secs (stop watch) which is much more that 10*.0102 Why is this?

$ python3 -m timeit -s 'from debruijn_compat import debruijn_bytes as d'
'd(4, 11)'
10 loops, best of 3: 480 msec per loop​
This took ~20 secs vs .480*10

d(4, 14) takes about 24 seconds (one run)

Vincent Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140123/557b3c48/attachment.html>


More information about the Python-list mailing list