Dailydave mailing list archives
Re: Why you care about this sort of Python bug.
From: Imri Goldberg <lorgandon () gmail com>
Date: Wed, 02 Apr 2008 01:43:11 +0300
Dave Aitel wrote:
As many people noticed, this is it. Essentially the following line is equivalent with strdup(data+1024). ~ data=data[1024:] Below you can see an exponential increase in time...
You cheated a little bit here - you gave it exponential increasing size of input. The time should grow only by O(n^2), which is still slow enough :)
$ time python /tmp/test.py 1000 user 0m0.019s $ time python /tmp/test.py 10000 user 0m0.043s $ time python /tmp/test.py 100000 user 0m2.251s $ time python /tmp/test.py 1000000 user 6m45.435s Code for test.py: import sys count=int(sys.argv[1]) data="A"*count for i in xrange(len(data)): ~ data=data[1:]
Cheers, Imri ------------------------- Imri Goldberg www.algorithm.co.il/blogs www.imri.co.il ------------------------- Insert Signature Here ------------------------- _______________________________________________ Dailydave mailing list Dailydave () lists immunitysec com http://lists.immunitysec.com/mailman/listinfo/dailydave
Current thread:
- Why you care about this sort of Python bug. Dave Aitel (Apr 01)
- Re: Why you care about this sort of Python bug. Imri Goldberg (Apr 02)
- Re: Why you care about this sort of Python bug. Michel Arboi (Apr 03)
- Re: Why you care about this sort of Python bug. Florian Weimer (Apr 07)
- Re: Why you care about this sort of Python bug. Michel Arboi (Apr 07)
- Re: Why you care about this sort of Python bug. Michel Arboi (Apr 03)
- Re: Why you care about this sort of Python bug. Imri Goldberg (Apr 02)