Big-O and performance for data engineers
Read complexity from code, find hidden quadratics, stream instead of loading, and measure.
Foundations · Python for data engineers · Gold · Performance, lesson 1 of 1
On this page
Read first: Lists, dicts and sets: what each operation costs · Generators and lazy evaluation (skip if you know them)
In plain words first
Looking for a friend in a stadium, you could walk past every seat (the time grows with the crowd), or check the one seat on their ticket (the same time however big the crowd). With twice as many people, the first takes twice as long and the second does not change.
Big-O is a short way of saying which of those your code is. It ignores the exact seconds and describes how the time grows as the data grows, which is what matters at a million rows.
Unlock the full lesson
You have read the free part. The rest of this advanced lesson:
- Big-O in one table
- Hidden quadratics
- Memory: stream by default
- Measure, then fix
- When to leave plain Python
- Common mistakes
- Key takeaways
- Interview prep with 3 follow-up questions
- Check yourself: 3 questions
Unlock it with the Complete pass (every advanced problem and lesson) or on its own.
Practise this
Problems that use this, graded on hidden tests
Keep going
Last lesson of Python for data engineersBack to the journey →
Related lessons
Lists, dicts and sets: what each operation costsPython for data engineers · 5 min read
Wrangling data without pandas
Previous: Graphs and topological sort
Primary sources: Time complexity (Python wiki) · The Python profilers