mik-laj commented on pull request #8855:
URL: https://github.com/apache/airflow/pull/8855#issuecomment-628371106
Breeze on MacOS
```
Before:
Loop time: 153.950 ms
Loop time: 130.430 ms
Loop time: 138.379 ms
Loop time: 136.401 ms
Loop time: 129.030 ms
Loop time: 138.876 ms
Loop time: 136.068 ms
Loop time: 137.900 ms
Loop time: 128.807 ms
Loop time: 135.907 ms
Loop time: 131.712 ms
Loop time: 144.686 ms
Loop time: 133.606 ms
Loop time: 132.587 ms
Loop time: 141.669 ms
Average time: 136.791 ms
After:
Loop time: 0.017 ms
Loop time: 0.016 ms
Loop time: 0.006 ms
Loop time: 0.025 ms
Loop time: 0.042 ms
Loop time: 0.011 ms
Loop time: 0.008 ms
Loop time: 0.012 ms
Loop time: 0.150 ms
Loop time: 0.016 ms
Loop time: 0.009 ms
Loop time: 0.018 ms
Loop time: 0.006 ms
Loop time: 0.007 ms
Loop time: 0.010 ms
Average time: 0.144 ms
```
Native Mac OS
```
Before:
Loop time: 163.202 ms
Loop time: 135.025 ms
Loop time: 128.540 ms
Loop time: 128.556 ms
Loop time: 127.288 ms
Loop time: 132.704 ms
Loop time: 126.869 ms
Loop time: 128.493 ms
Loop time: 126.863 ms
Loop time: 130.054 ms
Loop time: 126.378 ms
Loop time: 127.801 ms
Loop time: 127.304 ms
Loop time: 127.238 ms
Loop time: 127.273 ms
Average time: 131.095 ms
After:
Loop time: 0.004 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Loop time: 0.001 ms
Average time: 0.009 ms
```
<details>
<summary> Benchmark </summary>
```python
from multiprocessing import Pool
from perf_kit.repeat_and_time import timing, repeat
REPEAT_COUNT = 15
def my_func(d):
return d + 1
@timing(REPEAT_COUNT)
@repeat(REPEAT_COUNT)
@timing()
def pool_slow(items):
with Pool(processes=1) as pool:
pool.map(my_func, items)
@timing(REPEAT_COUNT)
@repeat(REPEAT_COUNT)
@timing()
def pool_fast(items):
if len(items) == 1:
return my_func(items[0])
with Pool(processes=1) as pool:
pool.map(my_func, items)
print("Before:")
pool_slow([1])
print("After:")
pool_fast([1])
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]