Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Objective-Arts/lens-dist --skill optimization명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
SOC 직업 분류 기준
| name | optimization |
| description | Performance optimization |
| allowed-tools | [] |
John Carmack's core belief: Loaded loaded loaded. Every cycle counts, but only after you understand what you're doing. Write code that's easy to reason about, then optimize the hell out of it.
"If you want to do something really well, you have to understand it deeply. You can't just learn the API."
Don't just use libraries and frameworks. Understand what they're doing at the machine level. The programmers who make breakthroughs are the ones who understand the whole stack.
Carmack famously advocated for functional programming principles in C++:
"No matter what language you work in, programming in a functional style provides benefits. You should do it whenever it is convenient, and you should think hard about the decision when it isn't convenient."
Not this:
int globalCounter = 0;
void processItem(Item* item) {
item->value = compute(item->value);
globalCounter++; // Side effect
log(item); // Side effect
}
This:
Item processItem(Item item) {
return (Item){
.value = compute(item.value),
.processed = true
};
}
// Side effects at the edges
int main() {
Item result = processItem(input);
counter++;
log(result);
}
Use const aggressively. If it doesn't need to change, mark it const:
const char* getMessage(const Config* config) {
// Can't accidentally modify config
return config->message;
}
Carmack: "Use const everywhere you possibly can."
When performance matters (games, graphics, systems), optimize methodically:
"I can't stress this enough: understand what the machine is doing."
Know:
Carmack moved toward data-oriented design in later work:
Not this (Array of Structures):
struct Entity {
Vector3 position;
Vector3 velocity;
int health;
char name[32];
Texture* sprite;
// ... more fields
};
Entity entities[1000];
// Process positions - cache misses everywhere
for (int i = 0; i < 1000; i++) {
entities[i].position += entities[i].velocity;
}
This (Structure of Arrays):
struct Entities {
Vector3 positions[1000];
Vector3 velocities[1000];
int health[1000];
// ... arrays for each property
};
// Process positions - cache-friendly sequential access
for (int i = 0; i < 1000; i++) {
positions[i] += velocities[i];
}
"The first rule of optimization is: measure."
Profile before optimizing. The bottleneck is never where you think.
Carmack became a strong advocate for static analysis:
"Anything that can be done by static analysis to catch a bug before it happens is a win."
Use every tool available:
-Wall -Werror)"The cost of fixing a bug goes up by an order of magnitude at every stage: design, code, test, ship."
Catch bugs at compile time. Then at startup. Then in tests. Never in production.
From Carmack's practices and .plan files:
Keep related code together. Don't spread logic across files for "organization":
// Prefer: All player physics in one place, even if long
void UpdatePlayer(Player* p) {
// Movement
p->velocity += gravity * dt;
p->position += p->velocity * dt;
// Collision
if (CheckCollision(p->position)) {
ResolveCollision(p);
}
// Animation
UpdateAnimation(p, p->velocity);
}
"Premature abstraction is just as bad as premature optimization."
Don't create class hierarchies until you have three concrete examples. Don't add parameters until you need them.
Not this:
class AbstractEntityFactory {
virtual Entity* create(const EntityParams& params) = 0;
};
class ConcretePlayerFactory : public AbstractEntityFactory {
// ... 200 lines later, creates a Player
};
This:
Player* createPlayer(int x, int y) {
return new Player(x, y);
}
Carmack's code has strategic comments explaining why, especially for non-obvious optimizations:
// OPTIMIZATION: Using integer math here because the FPU pipeline
// would stall waiting for the divide. Measured 15% faster on target
// hardware (Pentium 166).
int approxDist = (dx > dy) ? dx + (dy >> 1) : dy + (dx >> 1);
Before committing code, ask:
Apply these checks:
Use a different skill when:
data-first (kernel style, data structures, taste)simplicity (Go Proverbs, interface design)clarity (general clarity, readability)distributed (statelessness, fault tolerance)Carmack is the performance-critical skill—use it when profiling has identified bottlenecks or you're writing game/graphics/real-time code.
"Focused, hard work is the real key to success. Keep your eyes on the goal, and just keep taking the next step towards completing it." — John Carmack