Faster than Google? Optimization lessons in Python.
summary
Porting word2vec into Python produces concrete results: an optimized Python port using generators, NumPy, Cython, BLAS runs substantially faster than naive code and—after hand‑tuned Cython cores, BLAS calls and careful memory management—claims 4x faster than Google’s C, 100x faster than optimized NumPy and 12,000x faster than pure Python. The implementation works at scale with streaming data, shows modest parallel scaling, doubles peak RAM versus the C build, and requires fragile low‑level fixes for BLAS and pointer code.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 1:15Python beyond Google C
- 3:21Porting word2vec to NumPy
- 6:52Core code to Cython
- 8:00Using BLAS for three times faster execution
- 9:45Optimization results
- 11:54Parallelizing word2vec
- 14:45Optimization trade-offs
- 17:59Project overview
- 19:23Q&A: Memory usage
- 20:50Q&A: Numba speedups
- 21:55Q&A: Performant Python
- 24:43Q&A: Gensim intro
- 26:06Q&A: Testing strategies
- 27:11Closing
related talks
34mNumPy: vectorize your brain
35mVectorization: How slow Python runs fast code
45mPython for Speed, Scale, and Science
39mPushing Cython to its Limits in Scikit-learn
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
42mLift your Speed Limits with Cython
37mBoost The Performance with Codon
