Devel::FastProf(3)

πŸ“¦
version 0.08 Β· 2 versions
, in fedora 43

πŸ’– 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 if fastprof.out isn't your moment, name it something else bestie ✨
  • usecputime β€” by default, Devel::FastProf meassures 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 corrupted fastprof.out file 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 -g is 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.com or 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 (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