view release on metacpan or search on metacpan
benchmark/vs_dumper.pl view on Meta::CPAN
getopts 'hn:b:' => \my %opts or usage;
usage if $opts{h};
my $file = $ARGV[0] or usage;
die "File not found: $file\n" unless -f $file;
my $data = `cat $file`;
my $iterations = $opts{n} || 1000;
my $block_size = $opts{b} || 512;
printf "%s bytes were read\n", length $data;
print "First serializing by eval...";
benchmark/vs_dumper.pl view on Meta::CPAN
print "done\n";
my @dumper_time;
my $time = time;
printf "Starting %d iterations for Dumper... ", $iterations;
for (1 .. $iterations) {
my $start_time = time;
my $str = Dumper($object);
push @dumper_time, time - $start_time;
}
benchmark/vs_dumper.pl view on Meta::CPAN
printf "done (%2.3f seconds)\n", $dumper_time;
my @ss_time;
$time = time;
printf "Starting %d iterations for Data::StreamSerializer... ", $iterations;
my $counter = 0;
for (1 .. $iterations) {
my $start_time = time;
$sr = new Data::StreamSerializer($object);
$sr->block_size($block_size);
$counter++ while defined $sr->next;
benchmark/vs_dumper.pl view on Meta::CPAN
printf "done (%2.3f seconds)\n", $ss_time;
print "\nDumper statistic:\n";
printf "\t%d iterations were done\n", $iterations;
printf "\tmaximum serialization time: %2.4f seconds\n", max(@dumper_time);
printf "\tminimum serialization time: %2.4f seconds\n", min(@dumper_time);
printf "\taverage serialization time: %2.4f seconds\n", avg(@dumper_time);
print "\nData::StreamSerializer statistic:\n";
printf "\t%d iterations were done\n", $iterations;
printf "\t%d SUBiterations were done\n", $counter;
printf "\tmaximum serialization time: %2.4f seconds\n", max(@ss_time);
printf "\tminimum serialization time: %2.4f seconds\n", min(@ss_time);
printf "\taverage serialization time: %2.4f seconds\n", avg(@ss_time);
printf "\taverage subiteration time: %2.5f seconds\n", $ss_time / $counter;
benchmark/vs_dumper.pl view on Meta::CPAN
usage: perl $0 [OPTIONS] test_file
OPTIONS:
-h - this helpscreen
-n count - iterations (default 1000)
-b count - bytes in one subiteration (default 512),
see perldoc Data::StreamDeserializer
hint: block_size
eof
exit 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/TreeDraw.pm view on Meta::CPAN
# however they are updated in different places!!! so for short periods are different. $flag_ind_next_iter also same again update at different point
sub _more_flags {
my $ref = shift;
$id{q{}.$ref} = 1;
#y set next_element to the next iterations value
$next_element = $ind{$ref};
$flag_ind_next_iter = $next_element;
$flag_ind_last = $indent;
$last_name = q{}.$ref;
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
-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="
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
bin/biorhythm view on Meta::CPAN
my ($begin, $end) = split(':', $__range);
die "positive integers please" if ($begin < 0);
die "positive integers please" if ($end < 0);
my $iterations = 1;
print "# $__birthday\n";
print "# $__day\n";
print " {\n";
view all matches for this distribution
view release on metacpan or search on metacpan
# check epoch days around the epoch
#
do {
my (@timevalues);
my $name = 'check epoch days around the epoch';
my $iterations = 10;
# check if this system can handle negative epoch values
@timevalues = localtime(-1);
# skip block:
SKIP: {
# skip section
if (! @timevalues) {
skip 'this system cannot handle dates before the epoch', $iterations;
}
# variables
my ($date, $control, @timevalues);
# get date object and control day
$date = Date::EzDate->new('Jan 4, 1970 5pm');
$control = $date->{'epoch day'};
foreach my $i (0..$iterations) {
err_comp(
$date->{'epoch day'},
$control,
"$name: iteration $i",
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Date/Gregorian.pm view on Meta::CPAN
zero and defines how many days the dates in the sequence lie apart.
It defaults to one.
Each iterator maintains its own state; therefore it is legal to run
more than one iterator in parallel or even create new iterators
within iterations.
=head2 set_easter
I<set_easter> computes the date of Easter sunday of a given year,
taking into account how the date object was configured.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/benchmark_date_parse.pl view on Meta::CPAN
my $date_string = '2015-01-14 21:07:31Z';
my $tests = [
{
'label' => 'Parse string',
'iterations' => 100000,
'coderef' => sub {
my $test_output = Date::Parse::str2time($date_string);
},
},
];
foreach my $test (@$tests) {
Benchmark::timethis(
$test->{'iterations'},
$test->{'coderef'},
$test->{'label'},
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Event/Random.pm view on Meta::CPAN
months => 4, # events occur about 3 times a year
start => DateTime->new( year => 2003 ),
end => DateTime->new( year => 2005 ) );
Note that the random values are generated on demand,
which means that the values may not be repeateable between iterations.
See the C<new_cached> constructor for a solution.
A C<DateTime::Set> object does not allow for the repetition of values.
Each element in a set is different.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Event/Sunrise.pm view on Meta::CPAN
of sunrise or sunset last computed.
=item c)
Iterate b) until the computed sunrise or sunset no longer changes significantly.
Usually 2 iterations are enough, in rare cases 3 or 4 iterations may be needed.
=back
However, I (second module maintainer) have checked with a few external
sources, to obtain test data. And actually, using the value 15.0 gives
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
-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="
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
-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
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