|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Imri Goldberg (lorgandon
gmail.com)
Date: Tue Apr 01 2008 - 17:43:11 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]