view release on metacpan or search on metacpan
lib/CTK/Skel/Daemon.pm view on Meta::CPAN
use base qw/CTK::Daemon/;
use constant {
FORKS => 1,
INTERVAL=> 1,
MAXITER => 10, # 10 iterations max
};
sub new {
my $class = shift;
my $name = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CWB/CQP/More/Iterator.pm view on Meta::CPAN
iterator.
=head2 C<forward>
Forwards the iterator the offset specified. If the offset is too big
(as in, more iterations than the size of the iterator) the iterator is
set to the last element. It also supports negative offsets (but please
use the C<backward> method).
The new position index is returned.
=head2 C<backward>
Backwards the iterator the offset specified. If the offset is too big
(as in, more iterations than the current position of the iterator) the
iterator is set to the first element. It also supports negative offsets
(but please use the C<forward> method).
The new position index is returned.
view all matches for this distribution
view release on metacpan or search on metacpan
t/03-lock-env.t view on Meta::CPAN
use Test::More skip_all => "need to deal with forking tests";
use Cache::BDB;
use strict;
my $kids = 5; # number of children to spawn
my $iterations = 1; # number of times each kid should do its thing
my $rows = 10; # number of rows each child should write, then read
my %options1 = (
cache_root => './t/03',
cache_file => "two.db",
t/03-lock-env.t view on Meta::CPAN
my $t0 = [gettimeofday];
my $c1 = Cache::BDB->new(%options1);
my $c2 = Cache::BDB->new(%options2);
for (0 .. $iterations) {
for (my $j = 1; $j <= $rows; $j++) {
my $r = $j x 4;
my $rv1 = $c1->set($j, { $j => $r} );
diag("$$ faild to write $j => $r") if $rv1;
view all matches for this distribution
view release on metacpan or search on metacpan
script/benchmark.pl view on Meta::CPAN
die <<HELP unless @ARGV;
Usage: $FindBin::Script HOST:PORT... [COUNT] ["compare"]
HOST:PORT... - list of memcached server addresses.
COUNT - number of iterations (default ${\default_iteration_count})
(each iteration will process ${\key_count} keys).
"compare" - literal string to enable comparison with
Cache::Memcached.
HELP
script/benchmark.pl view on Meta::CPAN
}
sub bench_finalize {
my ( $title, $code, $finalize ) = @_;
say "Benchmark: timing $count iterations of $title...";
my $b1 = timeit( $count, $code );
# We call nowait_push here. Otherwise the time of gathering
# the results would be added to the following commands.
my $b2 = timeit( 1, $finalize );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Carp/Capture.pm view on Meta::CPAN
#
# There are two other reasons, besides binary avoidance at the user-level,
# for mapping packstrings with the Callstacks hash. Repeated callstacks
# happen whenever capturing is requested from a loop. By mapping callstacks
# we only have to store a repeated callstack once. We can also help the user
# identify loop iterations by offering storage for an 'annotation' value.
#
# If the user provides an annotation then we will need to save a copy of it,
# which we do pushing it onto an array - the 'annotations' attribute. The
# index of the new element becomes the annotation's id.
#
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Carrot/Diversity/Block_Modifiers/Plugin/While/Fatal_Limit.pm view on Meta::CPAN
package Carrot::Diversity::Block_Modifiers::Plugin::While::Fatal_Limit
# /type class
# /implements [=component_pkg=]::_Prototype
# /capability "Limits the maximum number of iterations in while loops."
{
use strict;
use warnings 'FATAL' => 'all';
BEGIN {
view all matches for this distribution
view release on metacpan or search on metacpan
gctpc/alconinv.c view on Meta::CPAN
yp = yp + dyp;
ds = fabs(dxp) + fabs(dyp);
nn++;
if (nn > 20)
{
p_error("Too many iterations in inverse","alcon-inv");
return(235);
}
}
while (ds > EPSLN);
gctpc/alconinv.c view on Meta::CPAN
pow(((1.0 + esphi) / (1.0 - esphi)),(e / 2.0))) - HALF_PI - phi;
phi += dphi;
nn++;
if (nn > 20)
{
p_error("Too many iterations in inverse","alcon-inv");
return(236);
}
}
while(fabs(dphi) > EPSLN);
view all matches for this distribution
view release on metacpan or search on metacpan
ex/rails4_cookie_to_json.rb view on Meta::CPAN
# Default values for Rails 4 apps
key_iter_num = 1000
key_size = 32
salt = "encrypted cookie"
signed_salt = "signed encrypted cookie"
key_generator = ActiveSupport::KeyGenerator.new(key, iterations: key_iter_num)
secret = key_generator.generate_key(salt)[0..key_size-1]
sign_secret = key_generator.generate_key(signed_salt)
@encryptor = ActiveSupport::MessageEncryptor.new(secret, sign_secret, serializer: ActiveSupport::MessageEncryptor::NullSerializer)
end
view all matches for this distribution
view release on metacpan or search on metacpan
ex/rails4_cookie_to_json.rb view on Meta::CPAN
# Default values for Rails 4 apps
key_iter_num = 1000
key_size = 32
salt = "encrypted cookie"
signed_salt = "signed encrypted cookie"
key_generator = ActiveSupport::KeyGenerator.new(key, iterations: key_iter_num)
secret = key_generator.generate_key(salt)[0..key_size-1]
sign_secret = key_generator.generate_key(signed_salt)
@encryptor = ActiveSupport::MessageEncryptor.new(secret, sign_secret, serializer: ActiveSupport::MessageEncryptor::NullSerializer)
end
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Upgrading.pod view on Meta::CPAN
No upgrade is needed if your myapp_fastcgi.pl script is already upgraded
to use L<Catalyst::Script::FastCGI>.
=head2 Upgrading the mod_perl / Apache Engines
The engines that are built upon the various iterations of mod_perl,
L<Catalyst::Engine::Apache::MP13> (for mod_perl 1, and Apache 1.x) and
L<Catalyst::Engine::Apache2::MP20> (for mod_perl 2, and Apache 2.x),
should be seamless upgrades and will work using L<Plack::Handler::Apache1>
or L<Plack::Handler::Apache2> as required.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CatalystX/Crudite/Util/Random.pm view on Meta::CPAN
alligator
alligators
Allis
Allison
alliteration
alliterations
alliterative
allocatable
allocate
allocated
allocates
lib/CatalystX/Crudite/Util/Random.pm view on Meta::CPAN
iterate
iterated
iterates
iterating
iteration
iterations
iterative
iteratively
iterator
iterators
Ithaca
view all matches for this distribution
view release on metacpan or search on metacpan
root/static/js/yui/build/datatable/datatable-beta-min.js view on Meta::CPAN
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.5.0
*/
YAHOO.util.Chain=function(){this.q=[].slice.call(arguments);};YAHOO.util.Chain.prototype={id:0,run:function(){var F=this.q[0],C;if(!F||this.id){return this;}C=F.method||F;if(typeof C==="function"){var E=F.scope||{},B=F.argument||[],A=F.timeout||0,D=t...
A.sortable=this.sortable;A.sortOptions=this.sortOptions;A.width=this.width;return A;},getKey:function(){return this.key;},getKeyIndex:function(){return this._nKeyIndex;},getTreeIndex:function(){return this._nTreeIndex;},getParent:function(){return th...
if(A instanceof YAHOO.widget.Record){for(B=0;B<this._records.length;B++){if(this._records[B]&&(this._records[B]._sId===A._sId)){return A;}}}else{if(YAHOO.lang.isNumber(A)){if((A>-1)&&(A<this.getLength())){return this._records[A];}}else{if(YAHOO.lang....
this.setAttributeConfig("id",{value:YAHOO.widget.Paginator.id++,readOnly:true});this.setAttributeConfig("rendered",{value:false,readOnly:true});},initUIComponents:function(){var C=YAHOO.widget.Paginator.ui;for(var B in C){var A=C[B];if(YAHOO.lang.isO...
D.subscribe("recordOffsetChange",this.update,this,true);D.subscribe("beforeDestroy",this.destroy,this,true);D.subscribe("firstPageLinkLabelChange",this.update,this,true);D.subscribe("firstPageLinkClassChange",this.update,this,true);};B.FirstPageLink....
this.link.href="#";this.link.className=H;this.link.innerHTML=D;YAHOO.util.Event.on(this.link,"click",this.onClick,this,true);this.span.id=E+"-next-span";this.span.className=H;this.span.innerHTML=D;this.current=G.getCurrentPage()===F?this.span:this.li...
root/static/js/yui/build/datatable/datatable-beta-min.js view on Meta::CPAN
C.extend(G,F.Element,{initAttributes:function(J){J=J||{};G.superclass.initAttributes.call(this,J);this.setAttributeConfig("summary",{value:null,validator:C.isString,method:function(K){this._elThead.parentNode.summary=K;}});this.setAttributeConfig("se...
}else{if(J.removeAllRanges){J.removeAllRanges();}else{if(J.collapse){J.collapse();}}}}},_focusEl:function(J){J=J||this._elTbody;setTimeout(function(){try{J.focus();}catch(K){}},0);},_syncColWidths:function(){var R=this._oColumnSet.keys,J=this.getFirs...
this._elThead=a;M=this._elTbodyContainer.firstChild.appendChild(document.createElement("thead"));this._elA11yThead=M;P=[a,M];I.addListener(a,"focus",this._onTheadFocus,this);I.addListener(a,"keydown",this._onTheadKeydown,this);I.addListener(a,"mouseo...
K.cancelCellEditor();}var M=I.getTarget(L);var J=M.nodeName.toLowerCase();K.fireEvent("tableScrollEvent",{event:L,target:M});},_onDocumentClick:function(L,K){var M=I.getTarget(L);var J=M.nodeName.toLowerCase();if(!D.isAncestor(K._elContainer,M)){K.fi...
}var N=I.getTarget(M);var J=N.nodeName.toLowerCase();var L=true;while(N&&(J!="table")){switch(J){case"body":return ;case"input":if(N.type.toLowerCase()=="checkbox"){L=K.fireEvent("theadCheckboxClickEvent",{target:N,event:M});}else{if(N.type.toLowerCa...
}}return null;},initializeTable:function(){this._bInit=true;this._oRecordSet.reset();this._unselectAllTrEls();this._unselectAllTdEls();this._aSelections=null;this._oAnchorRecord=null;this._oAnchorCell=null;},render:function(){this._oChain.stop();this...
var J=false;var M=this.get("sortedBy");if(M&&(M.key===L.key)){J=true;if(M.dir){K=(M.dir==G.CLASS_ASC)?G.CLASS_DESC:G.CLASS_ASC;}else{K=(K==G.CLASS_ASC)?G.CLASS_DESC:G.CLASS_ASC;}}return K;},sortColumn:function(O,M){if(O&&(O instanceof YAHOO.widget.Co...
J.run();this.fireEvent("columnUnselectEvent",{column:L});}else{}}},getSelectedColumns:function(N){var K=[];var L=this._oColumnSet.keys;for(var M=0,J=L.length;M<J;M++){if(L[M].selected){K[K.length]=L[M];}}return K;},highlightColumn:function(K){var M=t...
if(!P){return null;}else{J=this.getRecord(P.recordId);K=this.getRecordIndex(J);O=this.getTrEl(J);N=this.getTrIndex(O);if(N===null){return null;}else{L.record=J;L.recordIndex=K;L.el=this.getTdEl(P);L.trIndex=N;L.column=this.getColumnById(P.columnId);L...
}}}}}else{this._oAnchorCell=O;this.selectCell(O);}}else{if(L){this._oAnchorCell=O;if(this.isSelected(O)){this.unselectCell(O);}else{this.selectCell(O);}}else{this._handleSingleCellSelectionByMouse(Z);}}}}},_handleCellBlockSelectionByKey:function(O){v...
}if(L){for(K=M.cells.length-1;K>S.colKeyIndex;K--){this.unselectCell(L.cells[K]);}}}}else{if(J==39){L=this.getNextTrEl(S.el);if(Q.recordIndex<S.recordIndex){if(S.colKeyIndex<M.cells.length-1){P=M.cells[S.colKeyIndex+1];this.selectCell(P);}else{if(L){...
J--){if(K[J].recordId&&K[J].columnId){return K[J];}}}},highlightRow:function(L){var J=this.getTrEl(L);if(J){var K=this.getRecord(J);D.addClass(J,G.CLASS_HIGHLIGHTED);this.fireEvent("rowHighlightEvent",{record:K,el:J});return ;}},unhighlightRow:functi...
},onDataReturnAppendRows:function(K,L,M){this.fireEvent("dataReturnEvent",{request:K,response:L,payload:M});var J=this.doBeforeLoadData(K,L,M);if(J&&L&&!L.error&&C.isArray(L.results)){this.addRows(L.results);this._handleDataReturnPayload(K,L,M);}else...
view all matches for this distribution
view release on metacpan or search on metacpan
t/Catmandu-IterableOnce.t view on Meta::CPAN
}
my $iter = T::IterableOnce->new;
is_deeply $iter->to_array, [1, 2, 3], 'first iteration gives results';
is_deeply $iter->to_array, [], 'repeated iterations give no results';
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chandra/HotReload.pm view on Meta::CPAN
Register paths (files or directories) to watch along with callbacks
that are invoked whenever a change is detected.
When integrated with L<Chandra::App> via C<< $app->watch() >>, the
event loop automatically switches to non-blocking mode and polls for
file changes between iterations.
=head1 METHODS
=head2 new(%args)
view all matches for this distribution
view release on metacpan or search on metacpan
t/coderef-map.t view on Meta::CPAN
ok $died, q[die in callback propagates to caller];
like $@, qr/callback error/, q[original error message preserved];
}
{
note "code ref die does not leak memory (no crash after many iterations)";
my @map = fresh_map();
$map[ ord('a') ] = sub { die "leak test" };
for (1..1000) {
eval { Char::Replace::replace( "abc", \@map ) };
}
pass q[1000 die-in-callback iterations: no crash or corruption];
}
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
share/plotly.js/plotly.min.js view on Meta::CPAN
* plotly.js v2.14.0
* Copyright 2012-2022, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self...
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
share/plotly.js/plotly.min.js view on Meta::CPAN
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
"use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=ne...
/*! Native Promise Only
v0.8.1 (c) Kyle Simpson
MIT License: http://getify.mit-license.org
*/
!function(t,r,n){r[t]=r[t]||n(),void 0!==e&&e.exports&&(e.exports=r[t])}("Promise",void 0!==t?t:this,(function(){"use strict";var t,e,n,i=Object.prototype.toString,a=void 0!==r?function(t){return r(t)}:setTimeout;try{Object.defineProperty({},"x",{}),...
share/plotly.js/plotly.min.js view on Meta::CPAN
/*
* @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc
* @license MIT
* @preserve Project Home: https://github.com/voidqk/polybooljs
*/
var n,i=t("./lib/build-log"),a=t("./lib/epsilon"),o=t("./lib/intersecter"),s=t("./lib/segment-chainer"),l=t("./lib/segment-selector"),c=t("./lib/geojson"),u=!1,f=a();function h(t,e,r){var i=n.segments(t),a=n.segments(e),o=r(n.combine(i,a));return n.p...
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Chess/Plisco/Engine/Win32Wrapper.pm view on Meta::CPAN
my $time_left = $params->{mytime} + $params->{movestogo} * $params->{myinc};
# FIXME! This should not be fixed_time but have a better name.
# FIXME! Depending on the volatility of the position, there should be
# a time cushion that can be used if the evaluation changes a lot between
# iterations.
$tree->{allocated_time} = int (0.5 + $time_left / $mtg);
}
sub movesToGo {
my ($self) = @_;
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
- Extra files from Apple 'make dist' causes issues on all
other OS's. Damn perl.org world-writeable issue with
Windows.
0.03 Thu May 4 14:10:40 2010
- Fixed bug in line_sessions(); too many for iterations.
- Fixed bug in interface_info(); if duplex not defined.
- Added option for /xx instead of dotted-octet format for
IP Mask in interface_ip().
- Updated error message details.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/Accessor/Lazy.pm view on Meta::CPAN
Same as C<mk_ro_accessors>, but creating lazy ones.
=head1 BENCHMARKING
Accessors benchmark:
Benchmark: timing 20000000 iterations of Acessor, AcessorF, Direct, Lazy, LazyF...
Acessor: 12 wallclock secs (11.34 usr + 0.00 sys = 11.34 CPU) @ 1763512.92/s (n=20000000)
AcessorF: 6 wallclock secs ( 5.71 usr + 0.00 sys = 5.71 CPU) @ 3502626.97/s (n=20000000)
Direct: 1 wallclock secs ( 0.78 usr + 0.00 sys = 0.78 CPU) @ 25641025.64/s (n=20000000)
Lazy: 14 wallclock secs (13.85 usr + 0.00 sys = 13.85 CPU) @ 1443730.60/s (n=20000000)
LazyF: 9 wallclock secs ( 8.71 usr + 0.00 sys = 8.71 CPU) @ 2297530.16/s (n=20000000)
Mutators benchmark:
Benchmark: timing 20000000 iterations of Acessor, AcessorF, Direct, Lazy, LazyF...
Acessor: 16 wallclock secs (15.26 usr + 0.00 sys = 15.26 CPU) @ 1310959.62/s (n=20000000)
AcessorF: 8 wallclock secs ( 7.91 usr + 0.00 sys = 7.91 CPU) @ 2528764.70/s (n=20000000)
Direct: 2 wallclock secs ( 1.50 usr + 0.00 sys = 1.50 CPU) @ 13351134.85/s (n=20000000)
Lazy: 19 wallclock secs (18.83 usr + 0.00 sys = 18.83 CPU) @ 1062191.30/s (n=20000000)
LazyF: 9 wallclock secs (10.53 usr + 0.00 sys = 10.53 CPU) @ 1899335.23/s (n=20000000)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/Delegator.pm view on Meta::CPAN
I whipped up a quick script to compare the performance of Class::Delegator to
Class::Delegation and a manually-installed delegation method (the control).
I'll let the numbers speak for themselves:
Benchmark: timing 1000000 iterations of Class::Delegation, Class::Delegator, Manually...
Class::Delegation: 106 wallclock secs (89.03 usr + 2.09 sys = 91.12 CPU) @ 10974.54/s (n=1000000)
Class::Delegator: 3 wallclock secs ( 3.44 usr + 0.02 sys = 3.46 CPU) @ 289017.34/s (n=1000000)
Control: 3 wallclock secs ( 3.01 usr + 0.02 sys = 3.03 CPU) @ 330033.00/s (n=1000000)
=head1 Bugs
view all matches for this distribution
view release on metacpan or search on metacpan
t/99-performance-regression.t view on Meta::CPAN
# Store individual timing results
my %timing_results;
sub run_highres_benchmark {
my ($code, $iterations) = @_;
$iterations ||= $ITERATIONS;
# Warm up
$code->() for 1..1000;
my $start = time();
$code->() for 1..$iterations;
my $end = time();
return $end - $start;
}
sub run_benchmarks {
my %results;
# Basic Object Creation
diag "\n=== Benchmarking Basic Object Creation ($ITERATIONS iterations) ===";
$timing_results{class_create} = run_highres_benchmark(sub {
Test::Performance::Class->new(name => 'test');
});
t/99-performance-regression.t view on Meta::CPAN
diag sprintf " Class: %.4f seconds", $timing_results{class_create};
diag sprintf " Class::More: %.4f seconds", $timing_results{class_more_create};
# Method Access
diag "\n=== Benchmarking Method Access ($ITERATIONS iterations) ===";
my $class_obj = Test::Performance::Class->new;
my $class_more_obj = Test::Performance::ClassMore->new;
$timing_results{class_access} = run_highres_benchmark(sub {
$class_obj->custom_method;
t/99-performance-regression.t view on Meta::CPAN
diag sprintf " Class: %.4f seconds", $timing_results{class_access};
diag sprintf " Class::More: %.4f seconds", $timing_results{class_more_access};
# Role Composition Performance - Same Role with different classes
diag "\n=== Benchmarking Role Composition ($ROLE_ITERATIONS iterations) ===";
$timing_results{class_with_role} = run_highres_benchmark(sub {
Test::Performance::ClassWithRole->new(name => 'test');
}, $ROLE_ITERATIONS);
t/99-performance-regression.t view on Meta::CPAN
diag sprintf " Class + Role: %.4f seconds", $timing_results{class_with_role};
diag sprintf " Class::More + Role: %.4f seconds", $timing_results{class_more_with_role};
# Role Method Access
diag "\n=== Benchmarking Role Method Access ($ITERATIONS iterations) ===";
my $class_role_obj = Test::Performance::ClassWithRole->new(name => 'test');
my $class_more_role_obj = Test::Performance::ClassMoreWithRole->new(name => 'test');
$timing_results{class_role_method} = run_highres_benchmark(sub {
$class_role_obj->role_method;
t/99-performance-regression.t view on Meta::CPAN
diag sprintf " Class + Role method: %.4f seconds", $timing_results{class_role_method};
diag sprintf " Class::More + Role method: %.4f seconds", $timing_results{class_more_role_method};
# Multiple Role Composition
diag "\n=== Benchmarking Multiple Role Composition (".($ROLE_ITERATIONS/2)." iterations) ===";
$timing_results{class_multi_role} = run_highres_benchmark(sub {
Test::Performance::ClassWithMultipleRoles->new;
}, $ROLE_ITERATIONS/2);
t/99-performance-regression.t view on Meta::CPAN
diag sprintf " Class + 3 Roles: %.4f seconds", $timing_results{class_multi_role};
diag sprintf " Class::More + 3 Roles: %.4f seconds", $timing_results{class_more_multi_role};
# Inheritance Performance
diag "\n=== Benchmarking Inheritance ($ITERATIONS iterations) ===";
$timing_results{class_inherit} = run_highres_benchmark(sub {
Test::Performance::ClassChild->new(name => 'test');
});
view all matches for this distribution
view release on metacpan or search on metacpan
benchmark/class-std.pl view on Meta::CPAN
Each test creates an object an stacks two objects into it (two levels)\n";
for my $class ('MyBenchTestFastCache', 'MyBenchTestFastBasic') {
#, 'MyBenchTestFast', 'MyBenchTest') {
my $n = 100000;
print "\n$class ($n iterations - first run)\n";
timethis $n, sub {
push @list, $class->new();
$list[-1]->set_one($class->new());
$list[-1]->get_one()->set_two($class->new());
$list[-1]->get_one();
};
print "Cleanup: Destroying ${ \($n *3) } objects\n";
timethis 1, sub { undef @list };
print "\n$class ($n iterations - second run)\n";
timethis $n , sub {
push @list, $class->new();
$list[-1]->set_one($class->new());
$list[-1]->get_one()->set_two($class->new());
$list[-1]->get_one();
view all matches for this distribution
view release on metacpan or search on metacpan
examples/refactor_until_clean.pl view on Meta::CPAN
# Create event loop
my $loop = IO::Async::Loop->new;
# Configure refactor options
my $options = Claude::Agent::Code::Refactor::Options->new(
max_iterations => 5, # Max review-fix cycles
min_severity => 'medium', # Only fix medium+ issues
categories => ['bugs', 'security'], # Focus on these
permission_mode => 'acceptEdits', # Auto-accept file edits
perlcritic => 1, # Include perlcritic analysis
perlcritic_severity => 4, # Perlcritic severity level
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Claude/Agent/Code/Review.pm view on Meta::CPAN
loop => $loop,
);
# Collect result asynchronously with iteration limit
my $result;
my $max_iterations = 1000; # Prevent infinite loops
my $iterations = 0;
while (my $msg = await $iter->next_async) {
$iterations++;
if ($msg->isa('Claude::Agent::Message::Result')) {
$result = $msg;
last;
}
if ($iterations >= $max_iterations) {
$iter->cleanup(); # Cleanup SDK server sockets
return Claude::Agent::Code::Review::Report->new(
summary => 'Review timed out: exceeded maximum iterations',
issues => [],
);
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Claude/Agent/Client.pm view on Meta::CPAN
# MEMORY WARNING: Each message object may be 1-100KB depending on content.
# At max (5000 messages), memory usage could reach 50MB-500MB.
# For long-running operations, consider processing messages incrementally
# using receive() in a loop rather than receive_until_result().
# Set CLAUDE_AGENT_MAX_MEMORY_MB to limit memory usage (default 500MB).
my $max_iterations = 1000;
my $max_allowed = 5_000; # Reduced to prevent memory exhaustion (each message ~1-100KB)
my $max_msg_env = $ENV{CLAUDE_AGENT_MAX_MESSAGES};
$max_msg_env =~ s/^\s+|\s+$//g if defined $max_msg_env; # trim whitespace
# Validate after trimming - must be positive integer > 0 (rejects 0 and leading zeros)
if (defined $max_msg_env && $max_msg_env =~ /^[1-9]\d*$/) {
$max_iterations = $max_msg_env;
if ($max_iterations > $max_allowed) {
$log->warning(sprintf("CLAUDE_AGENT_MAX_MESSAGES=%d exceeds maximum (%d), using %d. "
. "WARNING: High message counts risk memory exhaustion (estimated %dMB-%dMB at max). "
. "Set CLAUDE_AGENT_MAX_MEMORY_MB to limit memory, or use receive() for incremental processing.",
$max_iterations, $max_allowed, $max_allowed, $max_allowed / 10, $max_allowed / 1));
$max_iterations = $max_allowed;
}
elsif ($max_iterations > 2500) {
$log->warning(sprintf("CLAUDE_AGENT_MAX_MESSAGES=%d may cause high memory usage (estimated %dMB-%dMB). "
. "Consider using receive() with incremental processing or set CLAUDE_AGENT_MAX_MEMORY_MB.",
$max_iterations, $max_iterations / 10, $max_iterations / 1));
}
}
my $iterations = 0;
# Create JSON::Lines instance once outside the loop for better performance
require JSON::Lines;
my $jsonl = JSON::Lines->new;
while (my $msg = $self->receive) {
$iterations++;
push @messages, $msg;
# Estimate memory usage (rough heuristic based on message content)
# Estimate size based on raw data structure - use JSON::Lines for encoding
my $json_str = eval { $jsonl->encode([$msg->message // {}]) } // '{}';
$estimated_memory += length($json_str) + 500; # Add overhead estimate
lib/Claude/Agent/Client.pm view on Meta::CPAN
$log->warning(sprintf("receive_until_result: estimated memory usage (%d bytes) exceeds limit (%d bytes), breaking loop. "
. "Set CLAUDE_AGENT_MAX_MEMORY_MB to increase limit or use incremental processing.",
$estimated_memory, $max_memory_bytes));
last;
}
if ($iterations >= $max_iterations) {
$log->warning(sprintf("receive_until_result: processed max messages (%d), breaking loop. "
. "Set CLAUDE_AGENT_MAX_MESSAGES to increase limit.", $max_iterations));
last;
}
}
# Check if we exited without a Result (connection dropped)
if (@messages && !$messages[-1]->isa('Claude::Agent::Message::Result')) {
view all matches for this distribution
view release on metacpan or search on metacpan
bench/complex_insert_benchmark.pl view on Meta::CPAN
optional Nullable(UInt64)
) engine = Null'");
# Benchmark function
sub bench_insert {
my ($format, $data, $iterations) = @_;
my @times;
for my $i (1 .. $iterations) {
my $t0 = time();
open my $fh, '|-', "clickhouse-client --port $PORT --query 'insert into bench_complex format $format' 2>/dev/null"
or die "Cannot run clickhouse-client: $!";
binmode $fh;
print $fh $data;
view all matches for this distribution
view release on metacpan or search on metacpan
t/12-memleak.t view on Meta::CPAN
clone($tmp);
}
my $after = get_rss_kb();
my $delta = $after - $before;
ok($delta < 2000, "clone via intermediate variable does not leak (delta: ${delta} KB)")
or diag("Memory grew by $delta KB over 100K iterations");
}
}
# Test 5: direct hash miss should not leak (the actual bug from GH #42)
{
t/12-memleak.t view on Meta::CPAN
Clone::clone($data->{no_such_key});
}
my $after = get_rss_kb();
my $delta = $after - $before;
ok($delta < 2000, "clone of hash miss does not leak (delta: ${delta} KB)")
or diag("Memory grew by $delta KB over 100K iterations â GH #42 regression");
}
}
# Test 6: populated hash, direct miss should not leak
{
t/12-memleak.t view on Meta::CPAN
Clone::clone($hash{nonexistent});
}
my $after = get_rss_kb();
my $delta = $after - $before;
ok($delta < 2000, "clone of hash miss on populated hash does not leak (delta: ${delta} KB)")
or diag("Memory grew by $delta KB over 100K iterations");
}
}
# Test 7: clone of existing hash key should work fine and not leak
{
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
lib/Code/TidyAll.pm view on Meta::CPAN
is => 'lazy',
isa => t('Path'),
coerce => t('Path')->coercion_sub,
);
has iterations => (
is => 'ro',
isa => t('PositiveInt'),
default => 1,
);
lib/Code/TidyAll.pm view on Meta::CPAN
This affects both loading and running plugins.
=item * data_dir
=item * iterations
=item * mode
=item * no_backups
view all matches for this distribution