"Scott SA" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| On 11/12/07, Scott SA ([EMAIL PROTECTED]) wrote:
| I decided to test the speeds of the four methods:
|
|    set_example
|        s = set()
|        for url in urls:
|            if not url in s:
|                s.add(url)

How is that different in result from

set_example2
   s = set(urls)

which would be much faster,  faster, I would expect, than

|    dict_example
|        d = {}
|        for url in urls:
|            if url in d:
|                d[url] = 1
|

|    Starting tests with 500000 simulated URLs run 3 times.
|    ------------------------------------------------------------
|    'set' example
|                        run time: 0.5505 seconds
|    'dict' example
|                        run time: 0.2521 seconds

tjr



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to