Surveyor::App - Run benchmarks from a package
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.
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.
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.
Last, if you want to do some setup before your benchmarks run, define a tear_down method. The tear_down method gets no arguments.
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.
Find all of the subroutines that start with bench_ in PACKAGE and run each of them ITERATIONS times.
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.
brian d foy, <firstname.lastname@example.org>
Copyright © 2013-2022, brian d foy <email@example.com>. 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.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.