How to get a faster speed when using multi-threading in python

后端 未结 4 850
天命终不由人
天命终不由人 2020-12-01 15:00

Now i am studying how to fetch data from website as fast as possible. To get faster speed, im considering using multi-thread. Here is the code i used to test the difference

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-01 15:34

    A DNS lookup takes time. There's nothing you can do about it. Large latencies are one reason to use multiple threads in the first place - multiple lookups ad site GET/POST can then happen in parallel.

    Dump the sleep() - it's not helping.

提交回复
热议问题