Documentation
README
Performant Code
How to write code that won't timeout on large inputs.
Think About Scale First
Before writing code, ask: how big is the data?
| Data size | Approach |
|---|---|
| < 1 MB | Load into memory, any approach works |
| 1-100 MB | Load into memory, but use efficient algorithms |
| 100 MB - 1 GB | Stream/mmap, avoid loading entirely into memory |
| > 1 GB | Streaming only, chunk-based processing |
I/O Optimization
Large files
- mmap (C:
mmap(), Python:mmap.mmap()) — map file into memory, OS handles paging - Buffered binary reads —
fread()in C,open(f, 'rb').read(chunk)in Python - NEVER read a 500MB file line-by-line with
fgets()when you need random access
This is the opening of the README. Read the full README on GitHub.