NAME

Surveyor::App - Run benchmarks from a package

SYNOPSIS

use Surveyor::App;

DESCRIPTION

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.

run( PACKAGE, ITERATIONS, @ARGS )

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.

test( PACKAGE, @ARGS )

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.

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.

get_all_bench_( PACKAGE )

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).

TO DO

SEE ALSO

SOURCE AVAILABILITY

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

AUTHOR

brian d foy, <briandfoy@pobox.com>

COPYRIGHT AND LICENSE

Copyright © 2013-2024, brian d foy <briandfoy@pobox.com>. All rights reserved.

You may redistribute this under the terms of the Artistic License 2.0.