Surveyor::App - Run benchmarks from a package
use Surveyor::App;
Surveyor::App provides a minimal framework and convention for people to distribute benchmarks. By creating a package in a special way, you can easily share your benchmarks with people without having to repeat a lot of code.
Surveyor::App
First, if you want to do some setup before your benchmarks run, define a set_up method. Do whatever you need there, such as setting environment variables, changing directories, and so on. The set_up method gets the command-line arguments you specified when you run survey, save for any that survey used for itself.
set_up
survey
Next, define your benchmarks in subroutines whose names start with bench_. Surveyor::App will find each of those, using the part of the name after bench_ as the label for that test.
bench_
Last, if you want to do some setup before your benchmarks run, define a tear_down method. The tear_down method gets no arguments.
tear_down
Your benchmarking package doesn't have to have any particular name and it doesn't need to subclass or use this package. See Surveyor::GetDirectoryListing for an example.
use
Find all of the subroutines that start with bench_ in PACKAGE and run each of them ITERATIONS times.
PACKAGE
ITERATIONS
Before it does that, though, call the set_up routine in PACKAGE as a class method. After benchmarking, call the tear_down routine in PACKAGE as a class method.
Find all of the subroutines that start with bench_ in PACKAGE and run each of them once. Compare the return values of each to ensure they are the same.
Extract all of the subroutines starting with bench_ in PACKAGE. If you don't define a package, it uses the package this subroutine was compiled in (so that's probably useless).
This source is in a Git repository that I haven't made public because I haven't bothered to set it up. If you want to clone it, just ask and we'll work something out.
https://github.com/briandfoy/surveyor-app
brian d foy, <bdfoy@cpan.org>
<bdfoy@cpan.org>
Copyright © 2013-2022, brian d foy <bdfoy@cpan.org>. All rights reserved.
You may redistribute this under the terms of the Artistic License 2.0.
To install Surveyor::App, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Surveyor::App
CPAN shell
perl -MCPAN -e shell install Surveyor::App
For more information on module installation, please visit the detailed CPAN module installation guide.