Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Speed Improvement

by McA (Priest)
on Dec 01, 2014 at 19:11 UTC ( [id://1108871]=note: print w/replies, xml ) Need Help??


in reply to Speed Improvement

As a starting point:

sub mca_substitute { my $message = shift; $message =~ s/\{\\d(\d+)\}/myreplace($1)/ge; return $message; } sub myreplace { return '' unless $_[0]; my $string = ''; $string .= int(rand 10) for (1..$_[0]); return $string; }

You didn't present a runable example, so I can't do a benchmark. So, I just hope to have a faster version.

McA

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1108871]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-04-23 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found