$s = '0123456789'; printf "%x\n", unpack 'Q', pack 'P', $s while $s =~ /\G./g; # 55fd180fcc60 # 55fd18107f30 # 55fd18107ed0 # 55fd180e6700 # 55fd180fcc60 # 55fd18107f30 # 55fd18107ed0 # 55fd180e6700 # 55fd180fcc60 # 55fd18107f30

Looks like patterns don't matter, both between slashes (the above is for illusion of being useful, supposedly performed daily by thousands) and alternation of addresses, it just picks what's available.

use strict; use warnings; use feature 'say'; use Config; say "$^V / $Config{ archname }"; for my $len ( 1e4, 1e5, 1e6, 1e7 ) { my $s = 'a' x $len; my %h; my @before = times; $s =~ /\G./gs and ++ $h{ pack 'P', $s } for 1 .. $len / 100; # do just 1% !!! my @after = times; printf "Length: %8d, addresses: %6d, user: %6g, system: %6g\n", $len, scalar( keys %h ), $after[ 0 ] - $before[ 0 ], $after[ 1 ] - $before[ 1 ] } __END__ v5.40.3 / x86_64-linux-thread-multi Length: 10000, addresses: 1, user: 0, system: 0 Length: 100000, addresses: 1, user: 0, system: 0 Length: 1000000, addresses: 1, user: 0.01, system: 0 Length: 10000000, addresses: 1, user: 0.02, system: 0 v5.42.0 / x86_64-linux-thread-multi Length: 10000, addresses: 2, user: 0, system: 0 Length: 100000, addresses: 3, user: 0.01, system: 0 Length: 1000000, addresses: 3, user: 0.39, system: 0 Length: 10000000, addresses: 3, user: 139.87, system: 0 v5.43.8 / x86_64-linux Length: 10000, addresses: 2, user: 0, system: 0 Length: 100000, addresses: 3, user: 0.01, system: 0 Length: 1000000, addresses: 3, user: 0.38, system: 0 Length: 10000000, addresses: 3, user: 138.75, system: 0.01 v5.42.0 / MSWin32-x64-multi-thread Length: 10000, addresses: 2, user: 0, system: 0 Length: 100000, addresses: 2, user: 0, system: 0 Length: 1000000, addresses: 2, user: 0.844, system: 1.063 Length: 10000000, addresses: 70, user: 154.453, system: 253.812

It's much worse on Windows, with absurdly grotesque "system" time (I understand it's approximation for that OS); I can only assume buffers, when long enough (?), are continuously requested to be de-allocated and allocated, from OS, again and again, which is not the case with Perl on Linux.

If there's a bug it's a shock it goes unnoticed, I'm just a no-one. In fact I'm grateful that yesterday it wasn't possible to post, I now see the above is separate from another similar issue from 5.20 and on; better not to mix them together


In reply to 5.42: Does m// toss a string around? by Anonymous Monk

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, details, 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, summary, 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.