ワンクリックで
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