The Real Python Podcast cover image

Using NumPy and Linear Algebra for Faster Python Code

The Real Python Podcast

00:00

How a Race Is Stored in Memory Versus Lists

In Python, memory is divided up into these blocks and the blocks are called pages. The CPU won't do operations on variables unless they're directly in proximity to it. So pretty much what happens is you say create a variable called a, like a equals three or something in Python, that'll be stored on a page. In order for the CPU to do an operation on A, the whole page that A is located on will be copied or not copied moved close to the CPU. And then it gets moved back after the operations done. You can see that there's a cost involved here. But apparently this is actually the major reason that you have so much time cost when doing these sequential operations

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app