在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用performant-code
Writing efficient code that handles large data and tight constraints
星标872
分支97
更新时间2026年2月23日 22:30
SKILL.md
readonly菜单
Writing efficient code that handles large data and tight constraints
Building, compiling, and resolving dependency issues across languages
Systematic code review for bugs, security, style, and performance
Working with diverse data formats: binary, text, structured, and custom
Systematic exploration of unknown environments before starting work
Git operations: commits, branches, PRs, and conflict resolution
Refactor code to improve structure and maintainability
| name | performant-code |
| description | Writing efficient code that handles large data and tight constraints |
| tags | ["performance","optimization","benchmark"] |
| version | 1.0.0 |
How to write code that won't timeout on large inputs.
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 |
mmap(), Python: mmap.mmap()) — map file into memory, OS handles pagingfread() in C, open(f, 'rb').read(chunk) in Pythonfgets() when you need random accesswrite() for every bytefwrite() or sys.stdout.buffer.write() for binary outputmmap() for large file access-O2 or -O3 for compiler optimizationsmalloc()/free() in tight loops — pre-allocatememcpy() instead of byte-by-byte copyingnumpy for numerical work (100x faster than pure Python loops)collections.Counter, defaultdict — avoid manual countingstruct.unpack() for binary parsingsubprocess.run() > os.system()wc -c