Things I don’t worry about as NumPy does them for me
summary
NumPy is a thin header pointing at a flat buffer so a transpose often just flips shape and strides instead of touching elements, while a reshape can trigger a 6.3 GB copy that costs bandwidth not CPU. Broadcasting uses zero strides to avoid tiling, and keeping values in cache matters. NumPy elides intermediates so an expression that looks like two allocations writes only one (temporary elision), but a Python 3.14 change caused two allocations and ~3× slowdown until fixed (stride zero).
AI-written summary · about
chapters (16)
- 0:00NumPy’s role in computing
- 1:30NumPy optimizations matter
- 3:15Cost of array copies
- 6:30NumPy arrays vs assumptions
- 8:56Transpose without copying
- 10:20Detect memory sharing in NumPy
- 11:26Memory bandwidth limits
- 13:16Avoid 6.3 GB copy
- 14:00Broadcasting silent optimization
- 16:50Broadcasting benefits
- 17:54Eliminate temp arrays
- 20:05NumPy temp array safety
- 21:50Python 3.14 impact
- 22:51Key takeaways
- 23:33Profile and optimize NumPy
- 24:16Q&A deferred evaluation
related talks
01h 27mMaking computation easier with cool Numpy tricks
01h 31mMaking Computation Easier with Cool Numpy Tricks
34mNumPy: vectorize your brain
27mAPL-Inspired Techniques for Advanced NumPy
35mVectorization: How slow Python runs fast code
32mYou don't always need NumPy
26mSmall Big Data: using NumPy and Pandas when your data doesn't fit ...
29mVectorize using linear algebra and NumPy to make your Python code fast
