in reply to How to find out, why my perl code is slow.
use Devel::NYTProf
Definitely use Devel::NYTProf.
The perl documentation also contains a section about this topic that should be read. See https://perldoc.perl.org/perlperf.html. The documentation for Devel::NYTProf gives more details about how to use it specifically.
An internet search will produce plenty of examples, but one that includes example output is at https://www.effectiveperlprogramming.com/2011/10/profile-with-develnytprof.