Devel::FastProf(3)
π Devel::FastProf π
okay so bestie, welcome to Devel::FastProf β the "fast" perl per-line profiler, brought to you by the fine folks in the User Contributed Perl Documentation section of your friendly neighborhood man pages. it's giving β¨speedβ¨, it's giving π¦insightπ¦, and it's literally about to tell you where your script is spending all its time. let's get into it π
πΈ SYNOPSIS πΈ
$ perl -d:FastProf my_script.pl
$ fprofpp -t 10
like. that's it. that's the whole vibe. two commands and you're a profiling girlie π
π ABSTRACT π
Devel::FastProf tells you how much time has been spent on every line of your program. per. line. not per-sub. every single line. obsessed honestly ππ
β¨ DESCRIPTION β¨
so Devel::FastProf is a perl per-line profiler. what does that mean, bestie? it means it can tell you how much time is spent on every line of a perl script β whereas the standard Devel::DProf is only a per-subroutine profiler. so DProf is like "this sub is slow" and FastProf is like "line 47 is the problem, i saw it, i clocked it, it's over for line 47 π
".
ngl, the author was the maintainer of Devel::SmallProf for a while, and even though they found it way more useful than Devel::DProf, it had one big limitation: it was terribly slow. we're talking around 50 times slower than the profiled script being run out of the profiler. fifty. 5-0. not it π
so they rewrote it from scratch in C, and the result is Devel::FastProf, which runs only between 3 and 5 times slower than under normal execution... and honestly? maybe they should've called it "Devel::NotSoSlowProf" ;-) the author said it, not me, i'm just the messenger π«Ά
π§ how do i even use this
to use Devel::FastProf with your programs, you have to call perl with the -d switch (see perlrun) like this:
$ perl -d:FastProf my_script.pl
Devel::FastProf will write the profiling information to a file named fastprof.out under the current directory. yep, it just drops a whole file right there in your cwd. main character behavior honestly π
to analyse the info in that file, use the post processor script fprofpp that's included with this package. (peep that -t 10 in the synopsis β go read fprofpp's own page for the deets, iykyk.)
π passing options via the environment
some options can be passed to Devel::FastProf via the environment variable FASTPROF_CONFIG:
filename=otherfn.outβ lets you change the name of the output file. so iffastprof.outisn't your moment, name it something else bestie β¨usecputimeβ by default,Devel::FastProfmeassures the wall clock time spent on every line, but if this entry is included it will use the cpu time (user+system) instead. (yes, "meassures" β that's the original spelling, we don't fix the author's typo, we love them for it π)canforkβ this option has to be used if the profiled script forks new processes. if you forget to do so, a corruptedfastprof.outfile could be generated. π
real talk: activating this mode causes a big performance penalty because write operations from all the processes have to be serialized using locks. that is why it is not active by default. so only turn it on if you actually fork, bestie, don't be out here paying that tax for nothing π
this is an example of how to set those options:
$ FASTPROF_CONFIG="usecputime,filename=/tmp/fp.out" \
perl -d:FastProf myscript.pl
look at that line continuation. so clean. so cunt. slay π
π BUGS π
okay bestie, deep breath, this is the part where we keep it real:
- No Windows! No threads! that's it. that's the whole sentence. periodt. π
- Only tested on Linux. It is know not to work under Solaris. (again β "know", not "known". we respect the original text here π«Ά)
- The code of subroutines defined inside
eval "..."constructions that do not include any other code will not be available on the reports. this is caused by a limitation on the perl interpreter, so it's not FastProf's fault, it's just the vibes of the interpreter πΈ - Option
-gis buggy β it only works when all the modules are loaded in the original process. so like, sometimes it eats, sometimes it doesn't, and we respect that π - Perl 5.8.8 or later is recomended. (the original's spelling, again, we stan) Older versions have a bug that cause this profiler to be slower. so upgrade, bestie, do it for yourself π
- If you find any bug, please, send an e-mail to
sfandino@yahoo.comor report it via the CPAN RT system. the author wants to hear from you fr fr, don't be shy π©
π¦ SEE ALSO π¦
fprofpp, perlrun, Devel::SmallProf, Devel::Dprof, perldebug and perldebguts.
go read them. they're part of the lore. iykyk π₯
π COPYRIGHT AND LICENSE π
Copyright (C) 2005-2007 by Salvador FandiΓ±o <sfandino@yahoo.com>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
okay that's the whole page, bestie!! go profile something, find your slowest line, and let it know its time is up πβ¨
this little tour was brought to you by perl v5.42.0, dated 2025-07-25, from Devel::FastProf(3) in the User Contributed Perl Documentation. mwah π«Άπ
π¦ where this page comes from
- fedora 43: perl-Devel-FastProf 0.08-51.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms