Processing large JSON files without running out of memory
summary
Loading a 50 MB JSON file can use ~230 MB of RAM (about 4.5×) and a 10 GB file can demand ~40 GB, so peak memory is the limiter not average. Four practical fixes appear: buy more RAM, use compact in‑memory formats (awkward/Arrow → polars/pandas), only decode needed fields (message spec / pydantic tradeoffs), or process by streaming/chunking (iJSON, NDJSON lines) to keep memory bounded.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:10Ethical considerations
- 3:58Memory usage matters
- 6:43Measuring memory in Python
- 7:26Four solutions
- 10:39Efficient in-memory representations
- 14:51Load only needed data
- 17:39Streaming JSON files
- 22:18Alternatives to JSON
- 25:08Why measure memory
- 26:09Recap of strategies
- 26:54Q&A
related talks
30mProcessing large JSON files without running out of memory
01mSmall Big Data: using NumPy and Pandas
26mSmall Big Data: using NumPy and Pandas when your data doesn't fit ...
40m640K ought to be enough for anyone
33mSkinny Pandas Riding On A Rocket
32mOptimize Your JSON Payload Efficiency x10 times
50mWe Must Save the Last Giga of RAM
35mYour data fits in RAM: How to avoid cluster computing
