I did try cmpthese but I got error messages about the input file and it wouldn't run. My code:
#!/usr/bin/perl use strict; use warnings; use Benchmark 'cmpthese'; use Time::HiRes qw/tv_interval gettimeofday/; #https://perlmonks.org/index.pl?node_id=11164097 open my $fh, '<', 'try3.txt' or die $!; # try3.txt contains the origin +al data my $s; { local $/ = undef; #local $/ = '', is paragraph mode $s = <$fh>; # slurp file } $s = $s x 10_000; # 90_000 lines (30_000 records) close $fh or die $!; sub GRT { my $s = shift; map { unpack q{x4a*}, $_ } sort map { m{(\d+)(?=%)} && ( ~ pack( q{N}, $1 ) . pack( q{a*}, $_ ) ) } do { #local $/ = q{}; # $s is slurped before passing to split functi +on split m{(?<!\A)(?=>>>)}, $s; } } sub ST { my $s = shift; map {$_->[0]} sort {$b->[1] <=> $a->[1]} map {[$_, /(\d+)%/]} split(/^(?=>>> )/m, $s) } my $t0; my $elapsed; $t0 = [gettimeofday]; GRT($s); $elapsed = tv_interval ( $t0, [gettimeofday]); print "GRT time: ", $elapsed, "\n"; $t0 = [gettimeofday]; ST($s); $elapsed = tv_interval ( $t0, [gettimeofday]); print "ST time: ", $elapsed; =begin C:\Old_Data\perlp>perl GRT_ST_transform.pl GRT time: 0.222224 ST time: 0.05873 C:\Old_Data\perlp> =cut #cmpthese( -1, { 'a' => GRT($s), 'b' => ST($s) } ) ;
The input file was the 9 lines (that I expanded to 90_000 lines for the test):
>>> prd1701 Filesystem Size Used Avail Use% Moun +ted on /workspace 3.9T 887G 3.0T 13% /wor +kspace/data >>> prd1702 Filesystem Size Used Avail Use% Moun +ted on /workspace 3.9T 746G 3.1T 23% /wor +kspace/data >>> prd1703 Filesystem Size Used Avail Use% Moun +ted on /workspace 3.9T 687G 3.2T 18% /wor +kspace/data

In reply to Re^5: schwartzian transform problem by Cristoforo
in thread schwartzian transform problem - Solved by Cristoforo

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.