<jupyter_start><jupyter_text>Sync and All, All, All...а именно Asyncio, Threading and MultiprocessingОсновано на https://realpython.com/python-concurrency/.  IO Bound![](./images/io_bound.webp) CPU Bound![](./images/cpu_bound.webp)  I/O. Sync<jupyter_code>! python ./src/io_synchronous.py<jupyter_output>Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394[...]<jupyter_text>I/O. Asyncio![](./images/io_asyncio.webp)<jupyter_code>! python ./src/io_asyncio.py<jupyter_output>Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wikipedia.org/wiki/Ant
Read 120335 from https://en.wik[...]<jupyter_text>I/O. Threading![](./images/io_threading.webp)<jupyter_code>! python ./src/io_threading.py<jupyter_output>Read 10394 from https://www.jython.org
Read 10394 from https://www.jython.org
Read 10394 from https://www.jython.org
Read 10394 from https://www.jython.org
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 10394 from https://www.jython.org
Read 10394 from https://www.jython.org
Read 10394 from https://www.jython.org
Read 10394 from https://www.jython.org
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 625295 from https://en.wikipedia.org/wiki/Ant
Read 625295 from https[...]<jupyter_text>I/O. Multiprocessing![](./images/io_multiprocessing.webp)<jupyter_code>! python ./src/io_multiprocessing.py<jupyter_output>SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 625295 from https://en.wikipedia.org/wiki/Ant
SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 625295 from https://en.wikipedia.org/wiki/Ant
SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 625295 from https://en.wikipedia.org/wiki/Ant
SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 625295 from https://en.wikipedia.org/wiki/Ant
SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 625295 from https://en.wikipedia.org/wiki/Ant
SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 625295 from https://en.wikipedia.org/wiki/Ant
SpawnPoolWorker-4:Read 10394 from https://www.jython.org
SpawnPoolWorker-4:Read 625295 from https://en.wikipedia.org/wiki/Ant
SpawnPoolWorker-7:Read 625295 from https://en.wikipedia.org/w[...]<jupyter_text>CPU. Sync, Asyncio, Threading![](./images/cpu_bound.webp)<jupyter_code>! python ./src/cpu_synchronous.py
! python ./src/cpu_asyncio.py
! python ./src/cpu_threading.py<jupyter_output>Duration: 17.743988752365112 seconds<jupyter_text>CPU. Multiprocessing![](./images/cpu_multiprocessing.webp)<jupyter_code>! python ./src/cpu_multiprocessing.py<jupyter_output>Duration: 4.478253602981567 seconds
{'fraction_non_alphanumeric': 0.1406158070209845, 'fraction_numerical': 0.09982349480290253, 'mean_word_length': 4.698324022346369, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 81, 'lorem ipsum': 0, 'www.': 31, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '563809', 'license': 'MIT', 'n_tokens_mistral': 2196, 'n_tokens_neox': 1790, 'n_words': 367, 'path': 'labs/lab10/demo/Sync-and-All-All-All.ipynb', 'repo_name': 'Alvant/AdvancedPython2020', 'size': '5099'}