Benchmark::Apps(3pm)

πŸ“¦
version 0.05 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Benchmark::Apps β€” the bestie guide πŸ’–

Perl module Β· User Contributed Perl Documentation Β· Benchmark::Apps(3pm)

okay so. you wanna know how fast your stuff runs? same. this is Benchmark::Apps β€” a simple interface to benchmark applications. not just Perl apps either, we're talking applications. plural. equal opportunity benchmarking. periodt. ✨


✨ NAME ✨

Benchmark::Apps β€” simple interface to benchmark applications. that's it, that's the vibe, that's the whole name. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

so this module gives you a simple interface to benchmark applications (and no, they don't have to be Perl applications, she's flexible like that πŸ’…):

use Benchmark::Apps;

my $commands = {
     cmd1 => 'run_command_1 with arguments',
     cmd2 => 'run_command_2 with other arguments',
   };

my $conf = { pretty_print=>1, iters=>5 };

Benchmark::Apps::run( $commands, $conf );

look at that. two commands, a lil config hash, and bam, we're benchmarking. iconic. πŸ‘‘


🌸 DESCRIPTION 🌸

this module is here to do simple benchmarks on programs. fr fr. basically β€” and this is the important part, bestie, write it down β€” it can be used to benchmark any program that can be called with a system call. any. program. so yes, your own scripts, yes, random binaries off the internet, yes, that one thing your coworker wrote in 2009 and nobody understands. if the system can call it, she can time it. 😭πŸ”₯


πŸ’… FUNCTIONS πŸ’…

run

this method is used to run benchmarks. it runs the commands described in the hash you pass as an argument. πŸ“‹

it returns an hash of the results each command.

a second hash reference can be passed to this method too: a configuration hash reference. the values you pass in this hash override the default behaviour of the run method. so basically you're driving. you're the main character. πŸš—βœ¨

the configuration options available at this moment are:

  • pretty_print β€” when enabled it will print to stdout, in a formatted way, the results of the benchmarks as they finish running. you want this option when you're running benchmarks and you want to see the results progress as the tests run. you can disable it though, so you can perform automated benchmarks β€” no vibes, just data. πŸ€–
    • Options: true (1) or false (0)
    • Default: false (0)
  • iters β€” this is the number of iterations that each test will run. more iters = more time = more accurate-ish, you decide. πŸ”
    • Options: integer greater than 1
    • Default: 5
  • args β€” this is a reference to an anonymous function that will calculate the command argument based on the iteraction number.
    • Options: any function reference that returns a string
    • Default: empty function: always returns an empty string, which means no arguments will be given to the command

run

(two runs, bestie, I don't make the rules, I just report them faithfully 🫢)

this method runs the commands described in the hash passed as argument. it returns an hash of the results and return codes for each command. yes, return codes, we stan accountability. πŸ“Š

pretty_print

this method is used to print the final result to STDOUT before returning from the run method. it's giving glow up for your terminal output. ✨

time_this

this method is not meant to be used directly, although it can be useful. πŸ‘€ it receives a command line and executes it via system, taking care of registering the elapsed time. so like. it's the little engine that times things. you can call her directly, she just wasn't designed for that kind of attention. πŸ™ˆ


🌈 EXAMPLES 🌈

check files in examples/. go look. they're right there. source material. πŸ“‚πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Aberto Simoes (aka ambs), <ambs at cpan.org> Nuno Carvalho (aka smash), <smash @ cpan.org>

two legends. respect. 🫑


πŸ’€ BUGS πŸ’€

please report any bugs or feature requests to bug-benchmark-apps at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Benchmark-Apps>.

I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. bestie communication pipeline. you report, I fix, we both know. 🀝

🧚 SUPPORT 🧚

you can find documentation for this module with the perldoc command:

perldoc Benchmark::Apps

you can also look for information at:


Copyright 2008 Aberto Simoes, Nuno Carvalho, all rights reserved.

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πŸͺ legally iconic.


and that's the whole page, bestie, you ate that. this was perl v5.36.0, dated 2022-10-13, and it's the Benchmark::Apps(3pm) manual β€” now go benchmark something and tell me the numbers. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from