원클릭으로
python-perf
Performant Python for scientific computing — vectorization, NumPy anti-patterns, preallocation
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Performant Python for scientific computing — vectorization, NumPy anti-patterns, preallocation
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Before writing new code — search existing implementations, topical audits, READMEs, file-header caveats
After implementing — update file headers, README, topical audits; note duplication
Navigate and debug OrbitalWar / SpaceCraft — design, truss sim, combat, radiosity, orbits; hub to docs and tests
Diagnostic plots/visualizations — shared utilities, output paths, plot style conventions
Dedicated documentation work — OKF format, topical audits, extract-overview and inline-doc workflows
Writing new code — inventory-first, module-vs-script placement, no-new-files, STOP triggers for duplication
| name | python-perf |
| description | Performant Python for scientific computing — vectorization, NumPy anti-patterns, preallocation |
| trigger | {"glob":["**/*.py","**/tests/**/*","**/*bench*.py","**/*perf*.py"]} |
Python is the harness, not the engine. Call NumPy or OpenCL kernels on as many items at once as possible to minimize harness overhead. Use advanced array slicing. NEVER write low-level hot loops in Python.
for i in range(len(array)): result[i] = array[i] * 2result = array * 2np.meshgrid, slicing, broadcasting, or OpenCL kernelsarray *= 2 vs array = array * 2)array[mask] for conditional selectionarray[:, :, 0] for channel extractionarray.reshape(-1) for flattening# WRONG: 1M Python iterations
for i in range(nx):
for j in range(ny):
result[i,j] = grid[i,j] * weight
# CORRECT: Single NumPy operation
result = grid * weight
# WRONG: Nested loops + stack overhead
positions = []
for ix in range(nx):
for iy in range(ny):
positions.append([x[ix], y[iy], z])
positions = np.array(positions)
# CORRECT: 3D grid directly, minimum allocation
xx, yy, zz = np.meshgrid(x, y, z, indexing='ij')
# Use xx, yy, zz directly as 3D arrays
# WRONG: Python loop with condition
for i in range(len(data)):
if data[i] > threshold:
result[i] = data[i] * scale
# CORRECT: Vectorized
mask = data > threshold
result[mask] = data[mask] * scale