Question
NYTProf vs Benchmark: Best Tool for Initial Bottleneck Identification in Perl
Sora Dey
0 reputation · 20 Jul 2021, 03:10 UTC
48.2K views0
Goal
Determine which documented profiling approach—Devel::NYTProf or Benchmark.pm—offers the most reliable insight into where a Perl program spends its time before any code changes.
Constraints & Uncertainty
- NYTProf provides per‑line and per‑subroutine inclusive/exclusive timings but incurs measurable overhead that skews absolute numbers.
- Benchmark measures only code supplied to it, requiring prior suspicion of hotspots and suffering from loop‑count sensitivity.
- Deciding whether to trust inclusive or exclusive times in NYTProf can lead to different optimization targets.
Questions
- For a large, complex script, should I start with a full NYTProf run to locate hotspots, or use Benchmark on a subset of suspected functions?
- When NYTProf’s inclusive and exclusive time rankings diverge, which metric should guide the first rewrite?
- What loop‑count strategy in Benchmark best mitigates overhead bias for micro‑benchmarks of small subroutines?