Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

pi/agent/skills/optimize/references/doing-less.md

Raw
Rendered preview

Doing Less

same goal, fewer instructions.

Approach

  • redundant ops → compute once, not per iteration
  • dead code → remove branches/calculations that never affect output
  • logic simplification → flatten conditionals, reduce nesting, early returns
  • combine ops → merge passes where safe
  • efficient APIs → prefer built-in/library over hand-rolled
  • remove indirection → inline trivial functions, eliminate unnecessary abstractions

Principles

  • every instruction → measurable purpose
  • transformation that doesn't change behavior → question its necessity
  • simplest correct implementation → complexity is tax on future changes

Pitfalls

  • premature simplification → don't sacrifice correctness/readability for marginal gains
  • over-inlining → increases code size, hurts instruction cache
  • compiler already does this → verify before duplicating effort
# Doing Less

same goal, fewer instructions.

## Approach

- redundant ops → compute once, not per iteration
- dead code → remove branches/calculations that never affect output
- logic simplification → flatten conditionals, reduce nesting, early returns
- combine ops → merge passes where safe
- efficient APIs → prefer built-in/library over hand-rolled
- remove indirection → inline trivial functions, eliminate unnecessary abstractions

## Principles

- every instruction → measurable purpose
- transformation that doesn't change behavior → question its necessity
- simplest correct implementation → complexity is tax on future changes

## Pitfalls

- premature simplification → don't sacrifice correctness/readability for marginal gains
- over-inlining → increases code size, hurts instruction cache
- compiler already does this → verify before duplicating effort