view release on metacpan or search on metacpan
-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
view release on metacpan or search on metacpan
-npro
-nsfs
--blank-lines-before-packages=0
--opening-hash-brace-right
--no-outdent-long-comments
--iterations=2
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
# This appears to be needed with recent Perl::Tidy versions and
# Code::TidyAll. Otherwise it somehow turns UTF-8 POD text into
# ISO-8859-1. Setting this to utf8 doesn't work. This is almost certainly
# because of https://github.com/houseabsolute/perl-code-tidyall/issues/84
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Lite.pm view on Meta::CPAN
The C<use Module> row is somewhat misleading on its own: C<DateTime::Lite> loads C<DBD::SQLite>, which embeds a complete compiled SQLite engine (~14 MB of native code) regardless of how many timezone objects you create. When measuring the C<TimeZone>...
C<DateTime::TimeZone> pre-loads all IANA Olson definitions into memory on the first C<new()> call (roughly 3-4 MB of compiled Perl structures on top of the module overhead). C<DateTime::Lite::TimeZone> queries a compact SQLite database on demand and ...
=head2 CPU throughput (10,000 iterations, µs per call)
DateTime 1.66 DateTime::Lite
------- ------------- --------------
new( UTC ) ~13 µs ~10 µs
new( named zone, string ) ~25 µs ~64 µs (*)
lib/DateTime/Lite.pm view on Meta::CPAN
cd DateTime-Lite-vX.X.X
perl Makefile.PL && make # make sure the XS code is compiled
perl -Iblib/lib -Iblib/arch scripts/benchmark.pl
# More iterations for stable numbers:
perl -Iblib/lib -Iblib/arch scripts/benchmark.pl --iterations 50000
# Machine-readable CSV output:
perl -Iblib/lib -Iblib/arch scripts/benchmark.pl --csv > results.csv
=head1 USAGE
view all matches for this distribution
view release on metacpan or search on metacpan
-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
view release on metacpan or search on metacpan
t/05iterator.t view on Meta::CPAN
my $tmp = $iterator->next;
push @res, $tmp->ymd if defined $tmp;
}
$res = join( ' ', @res );
is( $res, '1810-09-01 1810-10-01 1810-11-01',
"3 iterations give $res" );
# sub-second iterator
{
my $count = 0;
t/05iterator.t view on Meta::CPAN
}
}
$res = join( ' ', @res );
is( $res, '1810-08-22T00:00:00.000000 1810-08-22T00:00:00.000001 1810-08-22T00:00:00.000002',
"3 iterations give $res" );
}
# test the iterator limits. Ben Bennett.
{
# Make a recurrence that returns all months
view all matches for this distribution
view release on metacpan or search on metacpan
-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
view release on metacpan or search on metacpan
DateTime-ISO8601-Interval-0.003/lib/DateTimeX/ISO8601/Interval.pm view on Meta::CPAN
returning new intervals.
=back
The iterator returned optionally accepts a single argument that can be used to indicate the
number of iterations to skip on that call. For instance:
my $monthly = DateTimeX::ISO8601::Interval->parse('R12/2013-01-01/P1M');
my $iterator = $monthly->iterator;
while(my $month = $iterator->(2)) {
# $month would be Feb, Apr, Jun, etc
view all matches for this distribution
view release on metacpan or search on metacpan
author/benchmark.pl view on Meta::CPAN
};
hr();
__END__
new()
Benchmark: timing 100000 iterations of datetime, moment...
datetime: 4 wallclock secs ( 4.06 usr + 0.01 sys = 4.07 CPU) @ 24570.02/s (n=100000)
moment: 1 wallclock secs ( 0.62 usr + 0.01 sys = 0.63 CPU) @ 158730.16/s (n=100000)
Rate datetime moment
datetime 24570/s -- -85%
moment 158730/s 546% --
----------------------------------------
now()
Benchmark: timing 100000 iterations of datetime, moment...
datetime: 4 wallclock secs ( 4.38 usr + 0.01 sys = 4.39 CPU) @ 22779.04/s (n=100000)
moment: 1 wallclock secs ( 0.59 usr + 0.00 sys = 0.59 CPU) @ 169491.53/s (n=100000)
Rate datetime moment
datetime 22779/s -- -87%
moment 169492/s 644% --
----------------------------------------
from_epoch()
Benchmark: timing 100000 iterations of datetime, moment...
datetime: 4 wallclock secs ( 4.27 usr + 0.01 sys = 4.28 CPU) @ 23364.49/s (n=100000)
moment: 1 wallclock secs ( 0.63 usr + 0.00 sys = 0.63 CPU) @ 158730.16/s (n=100000)
Rate datetime moment
datetime 23364/s -- -85%
moment 158730/s 579% --
----------------------------------------
calculate()
Benchmark: timing 100000 iterations of datetime, moment...
datetime: 20 wallclock secs (20.30 usr + 0.04 sys = 20.34 CPU) @ 4916.42/s (n=100000)
moment: 1 wallclock secs ( 1.07 usr + 0.00 sys = 1.07 CPU) @ 93457.94/s (n=100000)
Rate datetime moment
datetime 4916/s -- -95%
moment 93458/s 1801% --
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Decl/Semantics/Macro.pm view on Meta::CPAN
our $VERSION = '0.01';
=head1 SYNOPSIS
The C<Decl> macro facility is still pretty green; it will probably go through a few iterations before I really like it.
This initial implementation provides three tags: "define" defines a named macro that can then be used anywhere and will instantiate a new
node at build time based on its environment; "express" expresses a macro in situ at runtime; and "<=" defines and instantiates an anonymous
macro in place, also at runtime. I'm not 100% sure that the build time/runtime distinction will be terribly significant, but more use will
doubtlessly result in some places where it will be a useful one.
view all matches for this distribution
view release on metacpan or search on metacpan
t/10-codegen.t view on Meta::CPAN
let [$x, $y, @rest] = [$n, $n * 2, $n * 3, $n * 4];
push @seen, "$x:$y:@rest";
}
is($seen[0], '1:2:3 4', 'loop iteration 1');
is($seen[99], '100:200:300 400', 'loop iteration 100');
is(scalar(@seen), 100, 'all iterations ran');
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
support/perltidyrc view on Meta::CPAN
# I/O control
--add-terminal-newline
--character-encoding=utf8
--iterations=2
--output-line-ending=unix
--perl-best-practices -nst -nse
# Basic formatting options
view all matches for this distribution
view release on metacpan or search on metacpan
# if the $error error string is newline terminated then it
# is copied into $mess. Otherwise, $mess gets set (at the end of
# the 'else {' section below) to one of two things. The first time
# through, it is set to the "$error at $file line $line" message.
# $error is then set to 'called' which triggers subsequent loop
# iterations to append $sub to $mess before appending the "$error
# at $file line $line" which now actually reads "called at $file line
# $line". Thus, the stack trace message is constructed:
#
# first time: $mess = $error at $file line $line
# subsequent times: $mess .= $sub $error at $file line $line
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/DumpTrace/PPI.pm view on Meta::CPAN
=head2 Special handling for other foreach loops
When a program containing the regular C<foreach [$var] LIST> construction
is traced, the C<foreach ...> statement only appears in the trace
output for the first iteration of the loop, just like the C-style
for loop construct. For all subsequent iterations the
C<Devel::DumpTrace::PPI> module will prepend the first statement in the
block with C<FOREACH: {> I<loop-variable> C<}> to show the new
value of the loop variable at the beginning of each iteration.
$ perl -d:DumpTrace::PPI -e '
view all matches for this distribution
view release on metacpan or search on metacpan
examples/cache_benchmark.pl view on Meta::CPAN
}
sub cache_enabled {
$des->all(cache => 1,) for (1..50);
}
#Benchmark: timing 100 iterations of disabled, enabled...
# disabled: 170 wallclock secs (168.20 usr + 0.94 sys = 169.14 CPU) @ 0.59/s (n=100)
# enabled: 0 wallclock secs ( 0.28 usr + 0.01 sys = 0.29 CPU) @ 344.83/s (n=100)
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_basic.t view on Meta::CPAN
}
elsif ($reinject_retries--) {
push @{B::end_av()->object_2svref}, $end_worker;
}
else {
print STDERR "\n\nSomething is racing with @{[__FILE__]} for final END block definition - can't win after $max_retry iterations :(\n\n";
require POSIX;
POSIX::_exit( 255 );
}
};
eval 'END { push @{B::end_av()->object_2svref}, $end_worker }';
view all matches for this distribution
view release on metacpan or search on metacpan
t/MyTestHelpers.pm view on Meta::CPAN
# uncomment this to run the ### lines
#use Smart::Comments;
@ISA = ('Exporter');
@EXPORT_OK = qw(findrefs
main_iterations
warn_suppress_gtk_icon
glib_gtk_versions
any_signal_connections
nowarnings);
%EXPORT_TAGS = (all => \@EXPORT_OK);
t/MyTestHelpers.pm view on Meta::CPAN
#-----------------------------------------------------------------------------
# Gtk/Glib helpers
# Gtk 2.16 can go into a hard loop on events_pending() / main_iteration_do()
# if dbus is not running, or something like that. In any case limiting the
# iterations is good for test safety.
#
sub main_iterations {
my $count = 0;
if (DEBUG) { MyTestHelpers::diag ("main_iterations() ..."); }
while (Gtk2->events_pending) {
$count++;
Gtk2->main_iteration_do (0);
if ($count >= 500) {
MyTestHelpers::diag ("main_iterations(): oops, bailed out after $count events/iterations");
return;
}
}
MyTestHelpers::diag ("main_iterations(): ran $count events/iterations");
}
# warn_suppress_gtk_icon() is a $SIG{__WARN__} handler which suppresses spam
# from Gtk trying to make you buy the hi-colour icon theme. Eg,
#
t/MyTestHelpers.pm view on Meta::CPAN
while (! $done) {
if (DEBUG >= 2) { MyTestHelpers::diag ("wait_for_event() iteration $count"); }
Gtk2->main_iteration;
$count++;
}
MyTestHelpers::diag ("wait_for_event(): '$signame' ran $count events/iterations\n");
$widget->signal_handler_disconnect ($sig_id);
Glib::Source->remove ($timer_id);
}
view all matches for this distribution
view release on metacpan or search on metacpan
demo/1m_stmts.pl view on Meta::CPAN
# execute 1 million iterations of a 3 statement + condition loop
my $i = shift || 1_000_000;
while (--$i) {
1;
++$a;
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/SizeMe/Graph/static/jit-yc.js view on Meta::CPAN
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
(function(){window.$jit=function(x){x=x||window;for(var y in $jit){if($jit[y].$extend){x[y]=$jit[y]}}};$jit.version="2.0.1";var c=function(w){return document.getElementById(w)};c.empty=function(){};c.extend=function(y,w){for(var x in (w||{})){y[x]=w...
view all matches for this distribution
view release on metacpan or search on metacpan
--blank-lines-before-packages=0
--iterations=2
--no-outdent-long-comments
-b
-bar
-boc
-ci=4
view all matches for this distribution
view release on metacpan or search on metacpan
-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
view release on metacpan or search on metacpan
t/301_report_slowops.t view on Meta::CPAN
use Devel::StatProfiler -file => $profile_file, -interval => 1000;
my ($l1);
for (my $count = precision_factor == 1 ? 10000 : 20000; ; $count *= 2) {
my $start = time;
note("Trying with $count iterations");
t::lib::Slowops::foo($count);
-d '.' && $LONG_STR =~ s/ $// for 1..$count; BEGIN { $l1 = __LINE__ + 0 }
last if time - $start >= 0.5;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/WxProf/Treemap/Output/Imager.pm view on Meta::CPAN
# guess.
if (( $metrix[2] <= $width ) && ( $metrix[3] > $height )) {
# if there is a major difference in height, correct guess
if (( abs( $height - $metrix[3] ) / $height ) * $size >= 3 )
{
$self->{font_iters}++; $local_iters++; # track iterations
$self->{TEXT_DEBUG} && print STDERR "\tHeight restricted, changing $size =>";
$size = int( $size * ( $height / $metrix[3] ));
$self->{TEXT_DEBUG} && print STDERR "$size.\n";
lib/Devel/WxProf/Treemap/Output/Imager.pm view on Meta::CPAN
# 2. if our guess is way off width-wise, correct:
# if a correction would yeild a size change of more than 3,
# it is obviously worth it.
elsif ( ( abs( $width - $metrix[2] ) / $width ) * $size >= 3 )
{
$self->{font_iters}++; $local_iters++; # track iterations
$self->{TEXT_DEBUG} && print STDERR "\tOff by 3pts+, changing $size =>";
$size = int( $size * ( $width / $metrix[2] ));
$self->{TEXT_DEBUG} && print STDERR "$size.\n";
@metrix = $self->{FONT}->bounding_box(
string => $text,
lib/Devel/WxProf/Treemap/Output/Imager.pm view on Meta::CPAN
# if our guess was too large, try smaller values until there is a fit:
if (( $metrix[2] > $width ) || ( $metrix[3] > $height )) {
$self->{TEXT_DEBUG} && print STDERR "\tGuess ($size) too large.\n";
while ( ( $metrix[2] > $width ) || ( $metrix[3] > $height ) )
{
$self->{font_iters}++; $local_iters++; # track iterations
$size--;
return if ( $size < 5 );
@metrix = $self->{FONT}->bounding_box(
lib/Devel/WxProf/Treemap/Output/Imager.pm view on Meta::CPAN
# if our guess is too small, try larger values until there is a -no- fit:
elsif ( ( $metrix[2] <= $width ) && ( $metrix[3] <= $height )) {
$self->{TEXT_DEBUG} && print STDERR "\tGuess ($size) fits, adjusting.\n";
while ( ( $metrix[2] <= $width ) && ( $metrix[3] <= $height ) )
{
$self->{font_iters}++; $local_iters++; # track iterations
$size++;
$size++ if ( $size > 50 ); # grow a bit faster for big fonts
@metrix = $self->{FONT}->bounding_box(
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Developer/Dashboard/Auth.pm view on Meta::CPAN
die 'Username contains unsupported characters'
if $username !~ /\A[A-Za-z0-9_.-]{1,64}\z/;
die 'Password must be at least 8 characters long'
if length($password) < 8;
my $salt = sha256_hex( join ':', $$, time, rand(), $username );
my $iterations = $PBKDF2_ITERATIONS;
my $record = {
username => $username,
role => $role,
salt => $salt,
password_scheme => $PBKDF2_SCHEME,
iterations => $iterations,
password_hash => _pbkdf2_hmac_sha256_hex( $password, $salt, $iterations ),
updated_at => _now_iso8601(),
};
my $file = $self->_user_file($username);
open my $fh, '>:raw', $file or die "Unable to write $file: $!";
print {$fh} json_encode($record);
lib/Developer/Dashboard/Auth.pm view on Meta::CPAN
# Input: stored user hash reference, username string, candidate password string.
# Output: expected password-hash hex string for the record's declared scheme.
sub _expected_password_hash {
my ( $self, $user, $username, $password ) = @_;
if ( ( $user->{password_scheme} || '' ) eq $PBKDF2_SCHEME ) {
my $iterations = $user->{iterations} || $PBKDF2_ITERATIONS; # uncoverable condition false
return _pbkdf2_hmac_sha256_hex( $password, $user->{salt}, $iterations );
}
return $self->_password_hash( $username, $password, $user->{salt} );
}
# get_user($username)
lib/Developer/Dashboard/Auth.pm view on Meta::CPAN
sub _password_hash {
my ( $self, $username, $password, $salt ) = @_;
return sha256_hex( join ':', $salt, $username, $password );
}
# _pbkdf2_hmac_sha256_hex($password, $salt, $iterations)
# Stretches a password with PBKDF2-HMAC-SHA256 (RFC 2898). The 32-byte SHA-256
# output equals the derived-key length, so exactly one output block is needed.
# Input: password string, salt string, positive iteration count.
# Output: 64-character lowercase hex string of the derived key.
sub _pbkdf2_hmac_sha256_hex {
my ( $password, $salt, $iterations ) = @_;
my $u = hmac_sha256( $salt . pack( 'N', 1 ), $password );
my $result = $u;
for ( 2 .. $iterations ) {
$u = hmac_sha256( $u, $password );
$result ^= $u;
}
return unpack( 'H*', $result );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DhMakePerl/Command/make.pm view on Meta::CPAN
return $found ? 1 : 0;
}
sub reset_git_environment {
# The Git environment variables may be set from previous iterations
# of this program being run. In this case, it's possible that the
# Git module will use these to point to the wrong source tree.
delete $ENV{'GIT_DIR'};
delete $ENV{'GIT_WORK_TREE'};
}
view all matches for this distribution
view release on metacpan or search on metacpan
dcdb-query.perl view on Meta::CPAN
our %save = (format=>undef);
our $outfmt = 'text'; ##-- output format: 'text' or 'json'
our $pretty = 1;
our $dotime = 1; ##-- report timing?
our $niters = 1; ##-- number of benchmark iterations
##----------------------------------------------------------------------
## Command-line processing
##----------------------------------------------------------------------
GetOptions(##-- general
dcdb-query.perl view on Meta::CPAN
'pretty|p!' => \$pretty,
'ugly!' => sub {$pretty=!$_[1]},
'null|noout' => sub {$outfmt=''},
'score-format|sf|format|fmt=s' => \$save{format},
'timing|times|time|T!' => \$dotime,
'bench|n-iterations|iterations|iters|i=i' => \$niters,
);
if ($version) {
print STDERR "$prog version $DiaColloDB::VERSION by Bryan Jurish\n";
exit 0 if ($version);
dcdb-query.perl view on Meta::CPAN
#($rel,@query{qw(slice groupby query)}) = ('ddc',0,'l','"*=2 Mansch" #fmin 1'); ##-- missing {schön,ganz,",d} from list-client (was cutoff=>0, fixed with cutoff=>'' in Client::list)
}
##--/DEBUG queries
if ($niters != 1) {
$cli->info("performing $niters query iterations");
}
my $timer = DiaColloDB::Timer->start();
foreach my $iter (1..$niters) {
my $mp = $cli->query($rel, %query)
or die("$prog: query() failed for relation '$rel', query '$query{query}'".($isDiff ? " - '$query{bquery}'" : '').": $cli->{error}");
dcdb-query.perl view on Meta::CPAN
General Options:
-help # display a brief usage summary
-version # display program version
-[no]time # do/don't report operation timing (default=do)
-iters NITERS # benchmark NITERS iterations of query
Query Options:
-col, -ug, -ddc, -tdf # select profile type (collocations, unigrams, ddc client, tdf matrix; default=-col)
-(a|b)?date DATES # set target DATE or /REGEX/ or MIN-MAX
-(a|b)?slice SLICE # set target date slice (default=1)
dcdb-query.perl view on Meta::CPAN
Do/don't report operation timing (default=do).
=item -iters NITERS
Benchmark NITERS iterations of query (default=1).
=back
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
ex/benchmark.pl view on Meta::CPAN
use Digest::Shabal ();
use Digest::Skein ();
use Digest::Whirlpool ();
my %opts = (
iterations => -1,
size => 1, # kB
);
GetOptions(\%opts, 'iterations|i=i', 'size|s=f',);
my $data = '01234567' x (128 * $opts{size});
my %digests = (
blake_224 => sub { Digest::BLAKE::blake_224($data) },
view all matches for this distribution
view release on metacpan or search on metacpan
ex/benchmark.pl view on Meta::CPAN
use Digest::Shabal ();
use Digest::Skein ();
use Digest::Whirlpool ();
my %opts = (
iterations => -1,
size => 1, # kB
);
GetOptions(\%opts, 'iterations|i=i', 'size|s=f',);
my $data = '01234567' x (128 * $opts{size});
my %digests = (
blake_224 => sub { Digest::BLAKE::blake_224($data) },
view all matches for this distribution
view release on metacpan or search on metacpan
ex/benchmark.pl view on Meta::CPAN
use Digest::Shabal ();
use Digest::Skein ();
use Digest::Whirlpool ();
my %opts = (
iterations => -1,
size => 1, # kB
);
GetOptions(\%opts, 'iterations|i=i', 'size|s=f',);
my $data = '01234567' x (128 * $opts{size});
my %digests = (
blake_224 => sub { Digest::BLAKE::blake_224($data) },
view all matches for this distribution
view release on metacpan or search on metacpan
ex/benchmark.pl view on Meta::CPAN
use Digest::Shabal ();
use Digest::Skein ();
use Digest::Whirlpool ();
my %opts = (
iterations => -1,
size => 1, # kB
);
GetOptions(\%opts, 'iterations|i=i', 'size|s=f',);
my $data = '01234567' x (128 * $opts{size});
my %digests = (
blake_224 => sub { Digest::BLAKE::blake_224($data) },
view all matches for this distribution
view release on metacpan or search on metacpan
ex/benchmark.pl view on Meta::CPAN
use Digest::Shabal ();
use Digest::Skein ();
use Digest::Whirlpool ();
my %opts = (
iterations => -1,
size => 1, # kB
);
GetOptions(\%opts, 'iterations|i=i', 'size|s=f',);
my $data = '01234567' x (128 * $opts{size});
my %digests = (
blake_224 => sub { Digest::BLAKE::blake_224($data) },
view all matches for this distribution