Result:
found more than 868 distributions - search limited to the first 2001 files matching your query ( run in 2.892 )


Astro-satpass

 view release on metacpan or  search on metacpan

lib/Astro/Coord/ECI/TLE.pm  view on Meta::CPAN


#>>>	The following loop replaces some spaghetti involving an
#>>>	assigned goto which essentially executes the same big chunk
#>>>	of obscure code twice: once for the Sun, and once for the Moon.
#>>>	The comments "Do Solar terms" and "Do Lunar terms" in the
#>>>	original apply to the first and second iterations of the loop,
#>>>	respectively. The "my" variables declared just before the "for"
#>>>	are those values computed inside the loop that are used outside
#>>>	the loop. Accumulators are set to zero. -- TRW

#>>>trw    my $savtsn = 1.0E20;

 view all matches for this distribution


Async-Event-Interval

 view release on metacpan or  search on metacpan

t/09-locking.t  view on Meta::CPAN

    waitpid $_, 0 for @kids;

    my $v = $e->interval;
    ok $v == 100 || $v == 200,
        "concurrent interval() setters produce an expected value, got $v "
      . "(no corruption across $iters iterations x 2 children)";
}

# A LOCK_EX writer must block a LOCK_SH reader. Verify by holding
# LOCK_EX in a forked child and watching the parent's LOCK_SH wait
# for it.

t/09-locking.t  view on Meta::CPAN


    is $cb_count, 3, "interval mode (death after runs): callback ran 3 times";
    is scalar @finish_calls, 1,
        "interval mode (death after runs): finish called exactly once";
    is $finish_calls[0], 1, "...with exit code 1";
    is $e->runs, 3, "runs incremented for all iterations including the dying one";
    is $e->errors, 1, "errors incremented exactly once";
    like $e->error_message, qr/death-after-runs/,
        "interval mode (death after runs): error_message captured";

    $e->_pid(0);

 view all matches for this distribution


Async-Redis

 view release on metacpan or  search on metacpan

lib/Async/Redis/Subscription.pm  view on Meta::CPAN

# Exits cleanly when _dequeue returns undef (subscription closed or
# paused for reconnect). Dies with the typed error if _dequeue dies
# (fatal); _run_driver's Future failure is visible through the
# client's Future::Selector to any caller using run_until_ready.
#
# Periodic sleep(0) yield every MAX_SYNC_DEPTH iterations prevents
# stack growth when messages are pre-queued and await returns
# synchronously from an already-ready Future.
async sub _run_driver {
    my ($self) = @_;
    my $iter = 0;

 view all matches for this distribution


Async-Template

 view release on metacpan or  search on metacpan

lib/Async/Template/Directive.pm  view on Meta::CPAN

	 resvar => undef,
	 event  => \$event,
      } );
$block
   } else {
      die "WHILE loop terminated (> $while_max iterations)\\n"
	 unless \$context->event_top()->{failsafe};
$tail
   }
EOF

 view all matches for this distribution


Attribute-Cached

 view release on metacpan or  search on metacpan

lib/Attribute/Cached.pm  view on Meta::CPAN


=head1 PERFORMANCE

Automatically wrapping the caching logic requires a slightly generic approach
which may not be optimal.  The bundled C<attr_bench.pl> program tries to
quantify this.  In a sample run of 1,000,000 iterations, it can be seen that
the additional work requires approximately 10 millionths of a second per
iteration.  This is likely to be fast enough for most requirements.  

Using the Attribute::Handling (instead of manually using the C<encache>
subroutine which does the actual work) appears to be a tiny fraction of the

 view all matches for this distribution


Attribute-Params-Validate

 view release on metacpan or  search on metacpan

perltidyrc  view on Meta::CPAN

-npro
-nsfs
--blank-lines-before-packages=0
--opening-hash-brace-right
--no-outdent-long-comments
--iterations=2
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="

 view all matches for this distribution


Audio-LibSampleRate

 view release on metacpan or  search on metacpan

libsamplerate/Cfg/ltmain.sh  view on Meta::CPAN

        # Relative path, prepend $cwd.
        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
        ;;
    esac

    # Cancel out all the simple stuff to save iterations.  We also want
    # the path to end with a slash for ease of parsing, so make sure
    # there is one (and only one) here.
    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
    while :; do

 view all matches for this distribution


Authen-Passphrase

 view release on metacpan or  search on metacpan

lib/Authen/Passphrase/MD5Crypt.pm  view on Meta::CPAN

can in principle be an arbitrary byte string, and the MD5 message
digest algorithm.  First the passphrase and salt are hashed together,
yielding an MD5 message digest.  Then a new digest is constructed,
hashing together the passphrase, the salt, and the first digest, all in
a rather complex form.  Then this digest is passed through a thousand
iterations of a function which rehashes it together with the passphrase
and salt in a manner that varies between rounds.  The output of the last
of these rounds is the resulting passphrase hash.

In the crypt() function the raw hash output is then represented in ASCII
as a 22-character string using a base 64 encoding.  The base 64 digits

 view all matches for this distribution


Authen-SASL-SCRAM

 view release on metacpan or  search on metacpan

lib/Authen/SASL/SCRAM.pm  view on Meta::CPAN

   my $server => Authen::SASL->new(
       mechanism => 'SCRAM-SHA-1', # selected mechanism
       callback => {
            getsecret => sub {
                 my $username = shift;
                 return ($salt, $stored_key, $server_key, $iterations);
            },
       }
   );


 view all matches for this distribution


Authen-SCRAM

 view release on metacpan or  search on metacpan

lib/Authen/SCRAM/Client.pm  view on Meta::CPAN


# The derived PBKDF2 password can be reused if the salt and iteration count
# is the same as a previous authentication conversation.
has _cached_credentials => (
    is      => 'rw',
    default => sub { [ "", 0, "" ] }, # salt, iterations, derived password
);

#--------------------------------------------------------------------------#
# provided by Authen::SCRAM::Role::Common
#--------------------------------------------------------------------------#

lib/Authen/SCRAM/Client.pm  view on Meta::CPAN


    # assemble proof
    my $salt  = decode_base64( $self->_get_session("s") );
    my $iters = $self->_get_session("i");
    if ( $iters < $self->minimum_iteration_count ) {
        croak sprintf( "SCRAM server requested %d iterations, less than the minimum of %d",
            $iters, $self->minimum_iteration_count );
    }

    my ( $stored_key, $client_key, $server_key ) = $self->computed_keys( $salt, $iters );

 view all matches for this distribution


Authen-TOTP

 view release on metacpan or  search on metacpan

lib/Authen/TOTP.pm  view on Meta::CPAN

	 digits 	=>	[6|8],
	 period		=>	[30|60],
	 algorithm	=>	"SHA1", #SHA256 and SHA512 are equally valid
	 secret		=>	"the_same_random_stuff_you_used_to_generate_the_TOTP",
	 when		=>	<epoch_to_use_as_reference>,
	 tolerance	=>	<try this many iterations before/after when>
	 otp		=>	<OTP to compare to>
 );

 $gen->otp( <when> ); # Get the TOTP token at <epoch_to_use>
 

 view all matches for this distribution


BATsh

 view release on metacpan or  search on metacpan

t/0003-cmd-interpreter.t  view on Meta::CPAN

        BATsh->run_string(join("\n",
            'SET CMD_T7=0',
            'FOR /L %%N IN (1,1,5) DO SET /A CMD_T7=%CMD_T7%+1',
        ));
        _ok(( defined( $BATsh::Env::STORE{'CMD_T7'} ) ? $BATsh::Env::STORE{'CMD_T7'} : '' ) eq '5',
            'CMD7: FOR /L counts 5 iterations');
    },

    # CMD8: SET /A arithmetic
    sub {
        delete $BATsh::Env::STORE{'CMD_T8'};

 view all matches for this distribution


BSD-Sysctl

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.09 2009-09-14 17:52:15 UTC
    - Added support for 8.0, better handling of kern.geom.confxml
      et al., and an example, courtesy of Sergey Skvortsov.

0.08 2007-01-16 21:28:29 UTC
    - Added an iterator() method to permit iterations through
      the variable tree.
    - An iterator may be reset(), its points to something with
      a name() and a value().
    - For the sysctl variables that correspond to C structs that we
      decode, if the OS version does not define a member, then create

 view all matches for this distribution


BSD-stat

 view release on metacpan or  search on metacpan

stat.pm  view on Meta::CPAN

=head1 PERFORMANCE

You can use t/benchmark.pl to test the perfomance.  Here is the result
on my FreeBSD box.

  Benchmark: timing 100000 iterations of BSD::stat, Core::stat,
  File::stat...
  BSD::stat:  3 wallclock secs ( 2.16 usr +  0.95 sys =  3.11 CPU) @
32160.80/s (n=100000)
  Core::stat:  1 wallclock secs ( 1.18 usr +  0.76 sys =  1.94 CPU) @
51612.90/s (n=100000)

 view all matches for this distribution


BSON-XS

 view release on metacpan or  search on metacpan

bson/bson-timegm.c  view on Meta::CPAN

/*
** Adapted from code provided by Robert Elz, who writes:
**	The "best" way to do mktime I think is based on an idea of Bob
**	Kridle's (so its said...) from a long time ago.
**	It does a binary search of the time_t space. Since time_t's are
**	just 32 bits, its a max of 32 iterations (even at 64 bits it
**	would still be very reasonable).
*/

#ifndef WRONG
#define WRONG	(-1)

 view all matches for this distribution


Basic-Types-XS

 view release on metacpan or  search on metacpan

lib/Basic/Types/XS.pm  view on Meta::CPAN

			my $Code = Types::Standard::CodeRef->(sub { return 1 });
		},
	});


	Benchmark: timing 1000000 iterations of Basic::Types::XS, Types::Standard...
	Basic::Types::XS: 2.10176 wallclock secs ( 1.93 usr +  0.17 sys =  2.10 CPU) @ 476190.48/s (n=1000000)
	Types::Standard: 3.15881 wallclock secs ( 3.15 usr +  0.00 sys =  3.15 CPU) @ 317460.32/s (n=1000000)
			     Rate  Types::Standard Basic::Types::XS
	Types::Standard  317460/s               --             -33%
	Basic::Types::XS 476190/s              50%               --

 view all matches for this distribution


Batch-Batchrun

 view release on metacpan or  search on metacpan

Batchrun.pm  view on Meta::CPAN

   my $steparray;
   my $stepnum = 0;
   my $i;my $j;
   my $connect;
   my $cpu;
   my $iterations;
   my $status;
   my $cmd;
   print $Batch::Batchrun::EventSeparator;
   print "\n";
   print "     ######################################################################\n";

Batchrun.pm  view on Meta::CPAN

   print "     ----------------------------------------------------------------------\n";  
              
eval <<'____END_OF_PLAIN_STUFF';    
format STDOUT =
     @<<<<<<<<  @<<<<<<<<<<<<<<   @<<<<<<<   @<<<<<<<<<<     @<<<<  @<<<<<<
$stepnum,$cmd,$connect,$cpu,$iterations,$status
.
   
____END_OF_PLAIN_STUFF


   my %seen;
   foreach $num ( @Batch::Batchrun::StatsOrder )
     {

     $stepnum = $num;
     $iterations =  $Batch::Batchrun::Stats{$stepnum}{'Iterations'};
     next if $seen{$stepnum};
     $seen{$stepnum} = 1;
      if ($iterations > 0)
        {
        ($hours) = int($Batch::Batchrun::Stats{$stepnum}{StepTimes}/3600);
        ($minutes) = int(($Batch::Batchrun::Stats{$stepnum}{StepTimes} - ($hours * 3600))/60);
        ($seconds) = int (($Batch::Batchrun::Stats{$stepnum}{StepTimes} - ($hours * 3600) - ($minutes * 60)));
        $connect = sprintf("%2.2d:%2.2d:%2.2d",$hours,$minutes,$seconds);

Batchrun.pm  view on Meta::CPAN

        $status = 'Error  ' if ($status == $Batch::Batchrun::ErrorCode);
        $status = 'Warning' if ($status == $Batch::Batchrun::WarningCode);
        $cmd = $Batch::Batchrun::Stats{$stepnum}{'CommandName'};
        if ($cmd =~ /^DO|^GOSUB/io)
          {
          #$iterations = $Batch::Batchrun::Stats{$stepnum}{'LoopIterations'};
          $iterations-- if $iterations > 1;
          }
        $iterations = '' if $iterations < 2;
        #else
         # {
         # $iterations = '';
         # }

        write;
        }

 view all matches for this distribution


BeamerReveal

 view release on metacpan or  search on metacpan

beamer-reveal-example_files/libs/revealjs/plugin/highlight/highlight.esm.js  view on Meta::CPAN

function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete...
/*!
 * reveal.js plugin that adds syntax highlight support.
 */
const Rs={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",hljs:fs,init:function(e){let t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,...

 view all matches for this distribution


Beekeeper

 view release on metacpan or  search on metacpan

t/lib/Tests/Mqtt.pm  view on Meta::CPAN

    is( length( $received[0]->{payload} ), 1048576, "Got a 1 MiB message");


    if ($ENV{'PATH'} =~ m|^/home/david/|) {
        # The following test is important: it forces the event loop to send and
        # receive a message in multiple iterations, because it is bigger than OS 
        # buffers. So skip it only on selected smokers that are too slow to pass
        return "This test does not run reliably on constrained platforms";
    }

    $data = 'X' x 10485760;

 view all matches for this distribution


Bench

 view release on metacpan or  search on metacpan

lib/Bench.pm  view on Meta::CPAN

 304347 calls (60665/s), 5.017s (0.0165ms/call)

 # use Dumbbench as the backend
 % perl -MDumbbench -MBench -E'bench sub { ... }'
 % perl -MBench -E'bench sub { ... }, {dumbbench=>1, dumbbench_options=>{...}}'
 Ran 26 iterations (6 outliers).
 Rounded run time per iteration: 2.9029e-02 +/- 4.8e-05 (0.2%)

 # bench multiple codes
 % perl -MBench -E'bench {a=>sub{...}, b=>sub{...}}, {n=>-2}'
 % perl -MBench -E'bench [sub{...}, sub{...}]'; # automatically named a, b, ...

 view all matches for this distribution


Bencher-BPM

 view release on metacpan or  search on metacpan

bin/bencher-bpm  view on Meta::CPAN

 is_plain_arrayref 18519/s            56%                --         -9%       -11%
 is_arrayref       20408/s            71%               10%          --        -2%
 ref(ARRAY)        20833/s            75%               12%          2%         --

 % bencher-bpm -c 10000 RefUtil --timethese
 Benchmark: timing 10000 iterations of is_arrayref, is_plain_arrayref, ref(ARRAY), reftype(ARRAY)...
 is_arrayref:  1 wallclock secs ( 0.48 usr +  0.00 sys =  0.48 CPU) @ 20833.33/s (n=10000)
 is_plain_arrayref:  0 wallclock secs ( 0.51 usr +  0.00 sys =  0.51 CPU) @ 19607.84/s (n=10000)
 ref(ARRAY):  1 wallclock secs ( 0.49 usr +  0.00 sys =  0.49 CPU) @ 20408.16/s (n=10000)
 reftype(ARRAY):  1 wallclock secs ( 0.84 usr +  0.00 sys =  0.84 CPU) @ 11904.76/s (n=10000)

 view all matches for this distribution


Bencher-Backend

 view release on metacpan or  search on metacpan

lib/Bencher/Backend.pm  view on Meta::CPAN

            description => <<'_',

When benchmarking with the default <pm:Benchmark::Dumb> runner, will pass the
precision to it. The value is a fraction, e.g. 0.5 (for 5% precision), 0.01 (for
1% precision), and so on. Or, it can also be a positive integer to speciify
minimum number of iterations, usually need to be at least 6 to avoid the "Number
of initial runs is very small (<6)" warning. The default precision is 0, which
is to let Benchmark::Dumb determine the precision, which is good enough for most
cases.

When benchmarking with <pm:Benchmark> runner, will pass this value as the
C<$count> argument. Which can be a positive integer to mean the number of
iterations to do (e.g. 10, or 100). Or, can also be set to a negative number
(e.g. -0.5 or -2) to mean minimum number of CPU seconds. The default is -0.5.

When benchmarking with <pm:Benchmark::Dumb::SimpleTime>, this value is a
positive integer which means the number of iterations to perform.

When profiling, a number greater than 1 will set a repetition loop (e.g. C<<
for(1..100){ ... } >>).

This setting overrides `default_precision` property in the scenario.

lib/Bencher/Backend.pm  view on Meta::CPAN

(=number is smaller) than this limit, then this limit is used. For example, if
the scenario specifies `default_precision` 0.001 and `precision_limit` is set to
0.005 then 0.005 is used.

This setting is useful on slower computers which might not be able to reach the
required precision before hitting maximum number of iterations.

_
            schema => ['float*', between=>[0,1]],
        },
        action => {

lib/Bencher/Backend.pm  view on Meta::CPAN


You can use `Benchmark` runner (`Benchmark.pm`) if you are accustomed to it and
want to see its output format.

You can use `Benchmark::Dumb::SimpleTime` if your participant code runs for at
least a few to many seconds and you want to use very few iterations (like 1 or
2) because you don't want to wait for too long.

_
        },

lib/Bencher/Backend.pm  view on Meta::CPAN

Precision.

When benchmarking with the default L<Benchmark::Dumb> runner, will pass the
precision to it. The value is a fraction, e.g. 0.5 (for 5% precision), 0.01 (for
1% precision), and so on. Or, it can also be a positive integer to speciify
minimum number of iterations, usually need to be at least 6 to avoid the "Number
of initial runs is very small (<6)" warning. The default precision is 0, which
is to let Benchmark::Dumb determine the precision, which is good enough for most
cases.

When benchmarking with L<Benchmark> runner, will pass this value as the
C<$count> argument. Which can be a positive integer to mean the number of
iterations to do (e.g. 10, or 100). Or, can also be set to a negative number
(e.g. -0.5 or -2) to mean minimum number of CPU seconds. The default is -0.5.

When benchmarking with L<Benchmark::Dumb::SimpleTime>, this value is a
positive integer which means the number of iterations to perform.

When profiling, a number greater than 1 will set a repetition loop (e.g. C<<
for(1..100){ ... } >>).

This setting overrides C<default_precision> property in the scenario.

lib/Bencher/Backend.pm  view on Meta::CPAN

(=number is smaller) than this limit, then this limit is used. For example, if
the scenario specifies C<default_precision> 0.001 and C<precision_limit> is set to
0.005 then 0.005 is used.

This setting is useful on slower computers which might not be able to reach the
required precision before hitting maximum number of iterations.

=item * B<raw> => I<bool>

Show "raw" data.

lib/Bencher/Backend.pm  view on Meta::CPAN


You can use C<Benchmark> runner (C<Benchmark.pm>) if you are accustomed to it and
want to see its output format.

You can use C<Benchmark::Dumb::SimpleTime> if your participant code runs for at
least a few to many seconds and you want to use very few iterations (like 1 or
2) because you don't want to wait for too long.

=item * B<save_result> => I<bool>

Whether to save benchmark result to file.

 view all matches for this distribution


Bencher-Tiny

 view release on metacpan or  search on metacpan

bin/bencher-tiny  view on Meta::CPAN

 is_plain_arrayref 18519/s            56%                --         -9%       -11%
 is_arrayref       20408/s            71%               10%          --        -2%
 ref(ARRAY)        20833/s            75%               12%          2%         --

 % bencher-tiny -c 10000 RefUtil --timethese
 Benchmark: timing 10000 iterations of is_arrayref, is_plain_arrayref, ref(ARRAY), reftype(ARRAY)...
 is_arrayref:  1 wallclock secs ( 0.48 usr +  0.00 sys =  0.48 CPU) @ 20833.33/s (n=10000)
 is_plain_arrayref:  0 wallclock secs ( 0.51 usr +  0.00 sys =  0.51 CPU) @ 19607.84/s (n=10000)
 ref(ARRAY):  1 wallclock secs ( 0.49 usr +  0.00 sys =  0.49 CPU) @ 20408.16/s (n=10000)
 reftype(ARRAY):  1 wallclock secs ( 0.84 usr +  0.00 sys =  0.84 CPU) @ 11904.76/s (n=10000)

 view all matches for this distribution


Bencher

 view release on metacpan or  search on metacpan

lib/Bencher.pm  view on Meta::CPAN

=item * runner (str)

Set which runner to run the benchmark with. Either C<Benchmark::Dumb> (the
default), C<Benchmark> (C<Benchmark.pm>, to get Benchmark.pm-style output), or
C<Benchmark::Dumb::SimpleTime> (to be able to run a code with only 1 or 2
iterations without warning, suitable if your code that runs for at least a few
seconds and you don't want to wait for too long).

=item * on_failure (str, "skip"|"die")

For a command participant, failure means non-zero exit code. For a Perl-code

 view all matches for this distribution


Benchmark-Apps

 view release on metacpan or  search on metacpan

lib/Benchmark/Apps.pm  view on Meta::CPAN


Default: false (0)

=item C<iters>

This is the number of iterations that each test will run.

Options: integer greater than 1

Default: 5

 view all matches for this distribution


Benchmark-CSV

 view release on metacpan or  search on metacpan

examples/math/math.pl  view on Meta::CPAN

*STDERR->print("Running benchmark\n");
*STDERR->autoflush(1);
my $steps = 50;
*STDERR->print( q{[} . ( q[ ] x $steps ) . qq{]\r[} );
for ( 1 .. $steps ) {
  $bench->run_iterations( 10_000_000 / $steps );
  *STDERR->print("#");
}
*STDERR->print("]\n");
*STDERR->print("Generating plot\n");
system( "gnuplot", "plot.gnuplot" );

 view all matches for this distribution


Benchmark-Confirm

 view release on metacpan or  search on metacpan

lib/Benchmark/Confirm.pm  view on Meta::CPAN


    perl -MBenchmark::Confirm some_benchmark.pl

then you get the result of benchmark and the confirmination.

    Benchmark: timing 1 iterations of Name1, Name2, Name3...
         Name1:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
                (warning: too few iterations for a reliable count)
         Name2:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
                (warning: too few iterations for a reliable count)
         Name3:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
                (warning: too few iterations for a reliable count)
                        Rate Name3 Name1 Name2
    Name3 10000/s    --    0%    0%
    Name1 10000/s    0%    --    0%
    Name2 10000/s    0%    0%    --
    ok 1

lib/Benchmark/Confirm.pm  view on Meta::CPAN


    perl -MBenchmark::Confirm=TAP some_benchmark.pl

Then you get results as valid TAP like below.

    # Benchmark: timing 1 iterations of Name1, Name2, Name3...
    #      Name1:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
    #             (warning: too few iterations for a reliable count)
    #      Name2:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
    #             (warning: too few iterations for a reliable count)
    #      Name3:  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU)
    #             (warning: too few iterations for a reliable count)
    #                     Rate Name3 Name1 Name2
    # Name3 10000/s    --    0%    0%
    # Name1 10000/s    0%    --    0%
    # Name2 10000/s    0%    0%    --
    ok 1

 view all matches for this distribution


Benchmark-DKbench

 view release on metacpan or  search on metacpan

lib/Benchmark/DKbench.pm  view on Meta::CPAN


=head2 C<dkbench>

The main script that runs the DKbench benchmark suite. If L<BioPerl> is installed,
you may want to start with C<dkbench --setup>. But beyond that, there are many
options to control number of threads, iterations, which benchmarks to run etc:

 dkbench [options]

 Options:
 --threads <i>,  -j <i> : Number of benchmark threads (default is 1).
 --multi,        -m     : Multi-threaded using all your CPU cores/threads.
 --max_threads <i>      : Override the CPU detection to specify max CPU threads.
 --iter <i>,     -i <i> : Number of suite iterations (with min/max/avg at the end).
 --stdev                : Show relative standard deviation (for iter > 1).
 --include <regex>      : Run only benchmarks that match regex.
 --exclude <regex>      : Do not run benchmarks that match regex.
 --time,         -t     : Report time (sec) instead of score.
 --quick,        -q     : Quick benchmark run (implies -t).

 view all matches for this distribution


Benchmark-Lab

 view release on metacpan or  search on metacpan

lib/Benchmark/Lab.pm  view on Meta::CPAN

#pod It returns a hash reference with the following keys:
#pod
#pod =for :list
#pod * C<elapsed> – total wall clock time to execute the benchmark (including
#pod   non-timed portions).
#pod * C<total_time> – sum of recorded task iterations times.
#pod * C<iterations> – total number of C<do_task> functions called.
#pod * C<percentiles> – hash reference with 1, 5, 10, 25, 50, 75, 90, 95 and
#pod   99th percentile iteration times.  There may be duplicates if there were
#pod   fewer than 100 iterations.
#pod * C<median_rate> – the inverse of the 50th percentile time.
#pod * C<timing> – array reference with individual iteration times as (floating
#pod   point) seconds.
#pod
#pod =cut

lib/Benchmark/Lab.pm  view on Meta::CPAN

    my $pctiles = $self->_percentiles( \@timing );

    return {
        elapsed     => $wall_time,
        total_time  => List::Util::sum( 0, @timing ),
        iterations  => scalar(@timing),
        percentiles => $pctiles,
        median_rate => 1 / $pctiles->{50},
        timing      => \@timing,
    };
}

lib/Benchmark/Lab.pm  view on Meta::CPAN

    use Benchmark::Lab -profile => $ENV{DO_PROFILING};

    # Define a task to benchmark as functions in a namespace
    package My::Task;

    # do once before any iterations (not timed)
    sub setup {
        my $context = shift;
        ...
    }

lib/Benchmark/Lab.pm  view on Meta::CPAN

    sub after_task {
        my $context = shift;
        ...
    }

    # do once after all iterations (not timed)
    sub teardown {
        my $context = shift;
        ...
    }

lib/Benchmark/Lab.pm  view on Meta::CPAN


C<after_task> – run after I<each> C<do_task> function (not timed)

=item *

C<teardown> – run after all iterations are finished (not timed)

=back

Each task phase will be called with a I<context object>, which can be used
to pass data across phases.

lib/Benchmark/Lab.pm  view on Meta::CPAN

    sub do_task { ... }

=head2 Running benchmarks

A C<Benchmark::Lab> object defines the conditions of the test – currently
just the constraints on the number of iterations or duration of the
benchmarking run.

Running a benchmark is just a matter of specifying the namespace for the
task phase functions, and a context object, if desired.

lib/Benchmark/Lab.pm  view on Meta::CPAN


C<elapsed> – total wall clock time to execute the benchmark (including non-timed portions).

=item *

C<total_time> – sum of recorded task iterations times.

=item *

C<iterations> – total number of C<do_task> functions called.

=item *

C<percentiles> – hash reference with 1, 5, 10, 25, 50, 75, 90, 95 and 99th percentile iteration times.  There may be duplicates if there were fewer than 100 iterations.

=item *

C<median_rate> – the inverse of the 50th percentile time.

 view all matches for this distribution


Benchmark-MCE

 view release on metacpan or  search on metacpan

lib/Benchmark/MCE.pm  view on Meta::CPAN


 %stats = (
   $bench_name_1 => {times => [ ... ], scores => [ ... ]},
    ...
   _total => {times => [ ... ], scores => [ ... ]},
   _opt   => {iter => $iterations, threads => $no_threads, ...}
 );

Note that the times reported will be average times per thread (or per function
call if you prefer), however the scores reported (if a reference time is supplied)
are sums across all threads. So you expect for ideal scaling 1 thread vs 2 threads

lib/Benchmark/MCE.pm  view on Meta::CPAN

sense. Each of the benchmarks defined will launch on each of the threads, hence the
total workload is multiplied by the number of C<threads>. Times will be averaged
across threads, while scores will be summed.

=item * C<iter> (Int; default 1):
Number of suite iterations (with min/max/avg at the end when > 1).

=item * C<include> (Regex):
Only run benchmarks whose names match regex.

=item * C<exclude> (Regex):

lib/Benchmark/MCE.pm  view on Meta::CPAN


 my %scal = calc_scalability(\%stat_single, \%stat_multi, $keep_outliers?);

Given the C<%stat_single> results of a single-threaded C<suite_run> and C<%stat_multi>
results of a multi-threaded run, will calculate, print and return the multi-thread
scalability (including averages, ranges etc for multiple iterations).

Unless C<$keep_outliers> is true, the overall scalability is an average after droping
Benchmarks that are non-scaling outliers (over 2*stdev less than the mean).

The result hash return looks like this:

lib/Benchmark/MCE.pm  view on Meta::CPAN

    my @avg1 = _min_max_avg($stats1->{_total}->{$display});
    my @avg2 = _min_max_avg($stats2->{_total}->{$display});
    _print(__PACKAGE__, " summary ($cnt benchmark");
    _print("s") if $cnt > 1;
    _print(" x$opt->{scale} scale")     if $opt->{scale} > 1;
    _print(", $opt->{iter} iterations") if $opt->{iter} > 1;
    _print(", $opt2->{threads} threads):\n");
    $opt->{f} .= "s" if $opt->{time};
    my $f = $opt->{time} ? '%.3f' : '%.0f';
    $f = $opt->{iter} > 1 ? "$opt->{f}\t($f - $f)" : $opt->{f};
    @avg1 =  $opt->{iter} > 1 ? ($avg1[2], $avg1[0], $avg1[1]) : ($avg1[2]);

lib/Benchmark/MCE.pm  view on Meta::CPAN

    return %scal;
}

sub _init_options {
    my $opt = shift;
    $opt->{iter}  ||= $opt->{iterations} || 1;
    $opt->{bench} ||= $opt->{benchmarks} || $opt->{extra_bench};
    die "No benchmarks defined" unless $opt->{bench} && %{$opt->{bench}};
    foreach my $b (keys %{$opt->{bench}}) {
        if (!ref($opt->{bench}->{$b})) { # string
            my $f = eval "sub { $opt->{bench}->{$b} }";

lib/Benchmark/MCE.pm  view on Meta::CPAN

sub _total_stats {
    my $opt     = shift;
    my $stats   = shift;
    my $display = $opt->{time} ? 'times'      : 'scores';
    my $title   = $opt->{time} ? 'Time (sec)' : 'Score';
    _print(   "Aggregates ($opt->{iter} iterations"
            . ($opt->{threads} > 1 ? ", $opt->{threads} threads" : "") . "):\n"
            . _pad("Benchmark", 24)
            . _pad("Avg $title")
            . _pad("Min $title")
            . _pad("Max $title"));

 view all matches for this distribution


( run in 2.892 seconds using v1.01-cache-2.11-cpan-96521ef73a4 )