Asynchronous#
Code Example#
Example of how to run multiple browsers in asynchronous mode:
Python | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Which Method Is Faster?#
Multi-processing and multi-threading are the fastest methods, sometimes twice as fast as running the same job in linear or asynchronous mode. For instance, measuring execution time of the code examples below yield the results like this in seconds:
Method | Rank | Improvement | Average | Min | Max |
---|---|---|---|---|---|
Linear | Baseline | 8.59 | 8.55 | 8.62 | |
Asynchronous | 2 % | 8.42 | 8.33 | 8.48 | |
Multi-threading | 103 % | 4.24 | 4.20 | 4.29 | |
Multi-processing | 105 % | 4.20 | 3.69 | 6.05 |