Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
That would probably match if not beat join, if you weren't stringifying the array twice.

Actually you did that previously and I carelessly cargo-culted it into my code.
However upon testing it's actually very slightly faster! I don't know why:
perl -MBenchmark=:all -MAlgorithm::Combinatorics=:all -wle' for ("1".."4") { my $t0 = Benchmark->new; my $i = variations_with_repetition(["a".."z"],$ARGV[0]); my @x; push @x, pack "(A*)*", @$_ while $_=$i->next; my $t1 = Benchmark->new; my $ts = timestr(timediff($t1,$t0)); print $ts }' 4
1 wallclock secs ( 0.77 usr +  0.01 sys =  0.78 CPU)
1 wallclock secs ( 0.77 usr +  0.01 sys =  0.78 CPU)
1 wallclock secs ( 0.75 usr +  0.00 sys =  0.75 CPU)
1 wallclock secs ( 0.75 usr +  0.01 sys =  0.76 CPU)


perl -MBenchmark=:all -MAlgorithm::Combinatorics=:all -wle' for ("1".."4") { my $t0 = Benchmark->new; my $i = variations_with_repetition(["a".."z"],$ARGV[0]); my @x; push @x, pack "A*", qq[@$_] while $_=$i->next; my $t1 = Benchmark->new; my $ts = timestr(timediff($t1,$t0)); print $ts }' 4
0 wallclock secs ( 0.74 usr +  0.01 sys =  0.75 CPU)
1 wallclock secs ( 0.72 usr +  0.01 sys =  0.73 CPU)
1 wallclock secs ( 0.73 usr +  0.00 sys =  0.73 CPU)
1 wallclock secs ( 0.74 usr +  0.01 sys =  0.75 CPU)


perl -MBenchmark=:all -MAlgorithm::Combinatorics=:all -wle' for ("1".."4") { my $t0 = Benchmark->new; my $i = variations_with_repetition(["a".."z"],$ARGV[0]); my @x; push @x, join "", @$_ while $_=$i->next; my $t1 = Benchmark->new; my $ts = timestr(timediff($t1,$t0)); print $ts }' 4
1 wallclock secs ( 0.65 usr +  0.01 sys =  0.66 CPU)
1 wallclock secs ( 0.64 usr +  0.00 sys =  0.64 CPU)
0 wallclock secs ( 0.63 usr +  0.00 sys =  0.63 CPU)
1 wallclock secs ( 0.64 usr +  0.01 sys =  0.65 CPU)


BTW, that is one seriously quick machine you're running. What is it?

MacBook Pro i7
3.1GHz (4.1GHz Turbo Boost) 16GB RAM 1TB SSD
Darwin 10.13.4

STOP REINVENTING WHEELS, START BUILDING SPACE ROCKETS!CPAN 🐪

In reply to Re^8: list of four digit lock combinations without repeated digits by usemodperl
in thread list of four digit lock combinations without repeated digits by Lotus1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (4)
    As of 2019-06-25 05:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Is there a future for codeless software?



      Results (101 votes). Check out past polls.

      Notices?