NumPy: vectorize your brain
summary
Code examples show concrete wins: a pure Python Euclidean loop runs ~2.67 ms per call while a C version hits ~28 μs — Euclidean distance 2.67 ms vs 28 μs and common NumPy idioms give roughly 100x speedup over naive loops. The talk demonstrates universal functions, boolean masks, slicing views versus copies, broadcasting with no memory copy for broadcasts, and a compact K‑means implementation that actually runs and clusters the synthetic data.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:19KNearest Neighbors
- 3:59Python is slow
- 7:49Java vs Python
- 10:28What is NumPy
- 11:18Universal Functions
- 16:33Slicing Indexing
- 22:02Broadcasting
- 27:40Aggregations
- 29:25Summary
- 29:47Example
- 31:51Questions
related talks
35mVectorization: How slow Python runs fast code
38mVectorize all the things! Using linear algebra and NumPy to make your Python code lightning fast
23mPerformance Python: Seven Strategies for Optimizing Your Numerical Code
29mVectorize using linear algebra and NumPy to make your Python code fast
01h 31mMaking Computation Easier with Cool Numpy Tricks
01h 27mMaking computation easier with cool Numpy tricks
27mSpeed up Python with hardware accelerators
40mSpeed Without Drag
