~/talk

Parallelism Shootout: threads vs asyncio vs multiple processes

Talkat EuroPython 2015 · 2015-07-20..07-26· [python]
speakerdeck:s16h
slides:none on file

Downloads lots of URLs from a file and implements and times four concrete solutions: plain sequential loop, many threads backed by a Queue, a multiprocessing approach (including Pool), and a single-process asyncio coroutine solution using yield from and an event loop. Benchmarks use 30 URLs: sequential ~30s, threads drop to ~5s, multiprocessing similar, and asyncio scales best across larger URL sets. Code examples show the queue, Pool.map, coroutine structure and measured timings; everything runs and compares predictably.

AI-written summary · about

  1. 0:00Parallelism Shootout threadsve multiple processes asyncio
  2. 1:16Using three different modules: threading, multiprocessing and asyncio.
  3. 1:44Break down the problem.
  4. 2:01Before we begin...
  5. 3:02Before we parallelise...
  6. 5:27Actual real POSIX threads (pthreads) or Windows threads.
  7. 11:12threading example to multiprocessing...
  8. 11:42Convenient means of parallelising the execution of a function across multiple input values, distributing the input data across processes (data parallelism).
  9. 11:59sequential example to multiprocessing...
  10. 14:25Provides infrastructure for writing single- threaded concurrent code.
  11. 14:58Basic asynio Concepts
  12. 16:50The component that is in charge of keeping track of and scheduling all the coroutines that want time on the thread.
  13. 19:47Drum roll
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.