- Profile with `Devel::NYTProf` — run `perl -d:NYTProf script.pl` and open `nytprofhtml` to identify hot functions.
- Use `Benchmark.pm` with `cmpthese(-5, { impl1 => sub {...}, impl2 => sub {...} })` to compare alternative implementations.
- Prefer hash lookups over linear array searches for membership tests — build a `%seen` hash and use `exists $seen{$key}`.
- Use `Storable::dclone` for deep copies instead of `Dumper`/`eval` round-trips — it is significantly faster for large structures.
- Compile performance-critical subroutines as XS using `Inline::C` for prototyping or a full XS module for production.
- Use `List::Util::reduce`, `sum`, `max` instead of manual `foreach` loops — they use optimized C implementations.
- Avoid repeated regex compilation in loops — use the `o` modifier (`/pattern/o`) or pre-compile with `qr//` outside the loop.