소스 정보
- 저장소
- personamanagmentlayer/pcl
- 최근 소스 활동
- 2026년 1월 19일 22:04
- 감지된 SKILL.md 언어
- 영어
- 스타
- 40
- 포크
- 9
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/personamanagmentlayer/pcl --skill performance-expert명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | performance-expert |
| version | 1.0.0 |
| description | Expert-level performance optimization, profiling, benchmarking, and tuning |
| category | devops |
| tags | ["performance","optimization","profiling","benchmarking","scalability"] |
| allowed-tools | ["Read","Write","Edit","Bash(*)"] |
Expert guidance for performance optimization, profiling, benchmarking, and system tuning.
import cProfile
import pstats
import timeit
import memory_profiler
from functools import lru_cache
from typing import List
import numpy as np
# Performance Profiling
def profile_function(func):
"""Decorator for profiling function execution"""
def wrapper(*args, **kwargs):
profiler = cProfile.Profile()
profiler.enable()
result = func(*args, **kwargs)
profiler.disable()
stats = pstats.Stats(profiler)
stats.sort_stats('cumulative')
stats.print_stats(10) # Top 10 functions
return result
return wrapper
@profile_function
def slow_function():
total = 0
for i in range(1000000):
total += i
return total
# Memoization for expensive computations
@lru_cache(maxsize=128)
def fibonacci(n: int) -> int:
"""Cached Fibonacci calculation"""
if n < 2:
return n
return fibonacci(n-) + fibonacci(n-)
() -> []:
[x ** + * x + x data]
() -> np.ndarray:
data ** + * data +
():
total_time = timeit.timeit(
: func(*args),
number=iterations
)
avg_time = total_time / iterations
{
: total_time,
: avg_time,
: iterations
}
():
data = [i i ()]
(data)
() -> :
result =
item items:
result += item
result
() -> :
.join(items)
() -> []:
[i ** i (n)]
():
i (n):
i **
from sqlalchemy import create_engine, Index, text
from sqlalchemy.orm import sessionmaker
import redis
# Connection pooling
engine = create_engine(
'postgresql://user:pass@localhost/db',
pool_size=20,
max_overflow=0,
pool_pre_ping=True,
pool_recycle=3600
)
# Query optimization
class DatabaseOptimizer:
def __init__(self, session):
self.session = session
def bad_n_plus_one(self):
"""N+1 query problem"""
users = self.session.query(User).all()
for user in users:
posts = user.posts # Triggers additional query per user
print(f"{user.name}: {len(posts)} posts")
def good_eager_loading(self):
"""Eager loading to avoid N+1"""
from sqlalchemy.orm import joinedload
users = self.session.query(User)\
.options(joinedload(User.posts))\
.all()
for user in users:
posts = user.posts # No additional query
print(f": posts")
():
Index(, User.email)
Index(, Post.created_at)
Index(, Post.user_id, Post.status)
():
.session.bulk_insert_mappings(User, items)
.session.commit()
():
offset = (page - ) * page_size
.session.query(User)\
.order_by(User.created_at.desc())\
.limit(page_size)\
.offset(offset)\
.()
:
():
.redis = redis_client
():
cached = .redis.get(key)
cached:
json.loads(cached)
result = query_func()
.redis.setex(key, ttl, json.dumps(result))
result
():
data = .redis.get(key)
data :
data = fetch_func()
.redis.setex(key, ttl, json.dumps(data))
:
data = json.loads(data)
data
// Debouncing for expensive operations
function debounce(func, wait) {
let timeout;
return function executedFunction(...args) {
const later = () => {
clearTimeout(timeout);
func(...args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
// Example: Debounce search input
const searchInput = document.getElementById('search');
const debouncedSearch = debounce((query) => {
// Expensive search operation
fetchSearchResults(query);
}, 300);
searchInput.addEventListener('input', (e) => {
debouncedSearch(e.target.value);
});
// Lazy loading images
const lazyLoadImages = () => {
const images = document.querySelectorAll('img[data-src]');
const imageObserver = new IntersectionObserver((entries) => {
entries.( {
(entry.) {
img = entry.;
img. = img..;
img.();
imageObserver.(img);
}
});
});
images.( imageObserver.(img));
};
{
() {
. = container;
. = items;
. = itemHeight;
. = .(container. / itemHeight);
.();
}
() {
scrollTop = ..;
startIndex = .(scrollTop / .);
endIndex = startIndex + .;
visibleData = ..(startIndex, endIndex);
.. = visibleData
.( )
.();
}
}
() {
= ();
.();
}
from fastapi import FastAPI, BackgroundTasks
from fastapi.responses import StreamingResponse
import asyncio
from typing import AsyncGenerator
app = FastAPI()
# Async endpoints for I/O bound operations
@app.get("/users/{user_id}")
async def get_user(user_id: str):
"""Async endpoint for database queries"""
user = await db.fetch_user(user_id)
return user
# Streaming responses for large data
async def generate_large_file() -> AsyncGenerator[bytes, None]:
"""Stream large file in chunks"""
chunk_size = 8192
with open("large_file.csv", "rb") as f:
while chunk := f.read(chunk_size):
yield chunk
await asyncio.sleep(0) # Allow other tasks to run
@app.get("/download")
async def download_large_file():
return StreamingResponse(
generate_large_file(),
media_type="text/csv"
)
# Background tasks for long-running operations
@app.post()
():
background_tasks.add_task(heavy_processing_task)
{: }
aiohttp
:
():
.session =
():
.session = aiohttp.ClientSession(
connector=aiohttp.TCPConnector(limit=)
)
():
.session.close()
():
.session.get(url) response:
response.json()
from locust import HttpUser, task, between
class PerformanceTest(HttpUser):
wait_time = between(1, 3)
@task(3)
def get_users(self):
"""High frequency endpoint"""
self.client.get("/api/users")
@task(1)
def create_user(self):
"""Lower frequency endpoint"""
self.client.post("/api/users", json={
"email": "test@example.com",
"name": "Test User"
})
def on_start(self):
"""Login once per user"""
response = self.client.post("/api/login", json={
"username": "test",
"password": "password"
})
self.token = response.json()["token"]
❌ Premature optimization ❌ No profiling/measurement ❌ Optimizing wrong bottlenecks ❌ Ignoring caching ❌ Synchronous I/O operations ❌ No database indexes ❌ Loading all data at once