Async Techniques and Examples in Python Transcripts
Chapter: Welcome to the course
Lecture: Async for taking full advantage of modern CPUs
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Here's a graph we're going to come back to and analyze at great depth later in the course. It came from a presentation by Jeffrey Funk.
0:08
You can see the SlideShare link there if you want to go check it out. It's actually 172 slides.
0:13
I want to just call your attention to this graph around 2005. If you look at, most importantly, the dark blue line
0:21
that is single-threaded performance over time. Note, it's going up and up and up following Moore's law, that's the top line and then it flattens out
0:29
and it actually is trending downward. What is going on here? Well, look at the black line. We have the number of cores going from one up to many
0:39
right around 2005 and continuing on today. To take full advantage of modern hardware you have to target more than one CPU core.
0:49
The only way to target more than one CPU core is to do stuff in parallel. If we write a regular while loop
0:55
or some sort of computational thing in regular Python that is serial and it's only going to run on one core
1:00
and that means it's following that blue downward line. But if we can follow the number of cores growing, well, we can multiply
1:06
that performance massively, as we'll see. One of the reasons you care about asynchronous programming is if you have anything computational to do
1:16
that depends on getting done fast not like I'm calling a database or I'm calling a web service and I'm waiting.
1:21
That's a different type of situation we'll address. But no, I have this math problem or this data analysis problem
1:27
and I want to do it as fast as possible in modern hardware. You're going to see some of the techniques that we talk about in this course
1:33
allow us to target the new modern hardware with as much concurrency as needed to take full advantage of all the cores of that hardware.
1:41
So like I said, we're going to dig way more into this later I just want to set the stage that if you have
1:46
anything computational and you want to take full advantage of modern hardware, you need asynchronous programming.