Mailing List Archive

Benchmarking Pure Perl Trim Functions.
On Sat, 29 May 2021 at 09:56, demerphq <demerphq@gmail.com> wrote:
>
> On Sat, 29 May 2021 at 00:52, Joseph Brenner <doomvox@gmail.com> wrote:
> >
> > Some quick-and-dirty benchmarking, trimming 100,000 short strings:
...
> > However: I took it very easy on this case using short lines... it's
> > very sensitive to line length (that \g is checking every point in the
> > string) and it slows down by a factor of ten with lines that are only
> > around 80 chars long.
>
> THIS is the key point here. Run your benchmarks over strings of length
> 1, 10, 100, 1000, and include the examples I posted in another mail:

I put the following together. It benchmarks various techniques for trimming
strings at different string lengths and composition.

$ cat trim.pl
use strict;
use warnings;
use Benchmark qw(cmpthese timethese :hireswallclock);
use Test::More;
my $base= 'naive';
my @extra= qw(separate loop loop_chop loop2);
my @keys= ($base,@extra);
$|++;
printf "%4s %3s %3s %10s|%10s|".("%10s %10s|" x @extra)."\n",
"reps","ns","sp","len", $base, map { $_ , "as pct" } @extra;
printf "%.4s-%.3s-%.3s-%.10s+%.10s+".("%.10s-%.10s+" x @extra)."\n",
("-" x 10) x (5+2*@extra);
foreach my $segments (1,10,100,1000) {
foreach my $ns_len (1,2,5,10,25,100) {
foreach my $sp_len (1,2,5,10,25,100) {
my $descr= "segments: $segments non-space length: $ns_len space
length: $sp_len";
my $string= (" " x $sp_len) . ((("x" x $ns_len) . (" " x
$sp_len))x$segments);
my ($naive,$separate,$loop,$loop2,$loop_chop);
#diag "timing $descr\n";
my $str_len= length $string;
my $r= timethese -1, {
naive => sub { $naive= $string; $naive=~s/\A\s+|\s+\z//g;
},
separate => sub { $separate= $string; $separate=~s/\A\s+//;
$separate=~s/\s+\z//; },
loop => sub { $loop= $string; $loop=~s/\A\s+//; 1 while
$loop=~s/\s\z//; },
loop2 => sub {
$loop2= $string;
$loop2=~s/\A\s+//;
1 while
$loop2=~s/\s{16}\z//;
$loop2=~s/\s{8}\z//;
$loop2=~s/\s{4}\z//;
$loop2=~s/\s{2}\z//;
$loop2=~s/\s{1}\z//;
},
loop_chop => sub {
$loop_chop= $string;
$loop_chop=~s/\A\s+//;
chop($loop_chop) while $loop_chop=~m/\s\z/;
},
}, "none";
my @key= ($segments,$ns_len,$sp_len,$str_len);
my %rps;
my $max;
my $max_name;
foreach my $name (@keys) {
$rps{$name}= $r->{$name}->iters/$r->{$name}->real;
if (!defined $max or $max < $rps{$name}) {
$max= $rps{$name};
$max_name= $name;
}
}
my @data;
foreach my $name (@keys) {
my $fmt= $name eq $max_name ? "+" : "";
push @data, sprintf "%$fmt.1f",$rps{$name};
push @data, sprintf "%$fmt.1f",$rps{$name}/$rps{naive}*100
if $name ne "naive";
}
printf "%4d %3d %3d %10d|%10s|". ("%10s %10s|" x @extra) .
"\n", @key, @data;
$ENV{CHECK} and ok(
$naive &&
$naive eq $separate &&
$naive eq $loop &&
$naive eq $loop2 &&
$naive eq $loop_chop, "all results the same - $descr"
);
}
}
}

It produces the following report. The left side shows the composition of
the string, and its length. The next column is timing for the naive
s/\A\s+|\s+\z//g approach. The following four columns contain data for each
other comparison strategy. "separate" is standard recommended "less worse
way" of using two s/\A\s+// and s/\s+\z//. The rest are solutions I ginned
up knowing how the regex engine works to optimize the separate strategy.
The strategy that is the +best+ for any row is prefixed with a + sign.


reps ns sp len| naive| separate as pct| loop as
pct| loop_chop as pct| loop2 as pct|
-----------------------+----------+---------------------+---------------------+---------------------+---------------------+
1 1 1 3|+1757705.9| 1722645.2 98.0| 1346754.4
76.6| 1460137.6 83.1| 1234795.8 70.3|
1 1 2 5|+1767954.3| 1727402.3 97.7| 938354.5
53.1| 1069422.3 60.5| 1220935.1 69.1|
1 1 5 11|+1795476.6| 1728537.8 96.3| 500068.3
27.9| 594498.6 33.1| 914134.5 50.9|
1 1 10 21|+1802973.3| 1668560.7 92.5| 276854.3
15.4| 344098.8 19.1| 902688.3 50.1|
1 1 25 51|+1720894.0| 1547221.8 89.9| 119435.9
6.9| 150625.4 8.8| 685213.9 39.8|
1 1 100 201|+1418034.7| 1302023.4 91.8| 31939.3
2.3| 41388.1 2.9| 340764.2 24.0|
1 2 1 4| 1575700.7|+1695328.2 +107.6| 1336772.1
84.8| 1467319.5 93.1| 1230853.2 78.1|
1 2 2 6| 1581974.8|+1705458.9 +107.8| 928325.3
58.7| 1067259.2 67.5| 1058661.8 66.9|
1 2 5 12| 1624738.2|+1724010.4 +106.1| 499957.4
30.8| 573393.5 35.3| 922924.4 56.8|
1 2 10 22| 1628322.0|+1645636.7 +101.1| 276198.2
17.0| 342247.1 21.0| 821484.7 50.4|
1 2 25 52|+1549776.4| 1538065.2 99.2| 119481.1
7.7| 148029.2 9.6| 691068.5 44.6|
1 2 100 202|+1306857.0| 1301676.6 99.6| 31817.4
2.4| 41587.5 3.2| 323718.2 24.8|
1 5 1 7| 1185669.6|+1691598.2 +142.7| 1330096.1
112.2| 1452426.8 122.5| 1097320.8 92.5|
1 5 2 9| 1453834.2|+2041745.4 +140.4| 1111872.3
76.5| 1140493.7 78.4| 1209036.7 83.2|
1 5 5 15| 1115944.2|+1646570.6 +147.5| 493371.7
44.2| 567321.4 50.8| 824512.2 73.9|
1 5 10 25| 1206617.8|+1643729.1 +136.2| 279888.0
23.2| 346755.6 28.7| 845376.3 70.1|
1 5 25 55| 1184689.4|+1510205.0 +127.5| 118686.9
10.0| 149178.5 12.6| 616426.3 52.0|
1 5 100 205| 1039192.6|+1270575.0 +122.3| 31737.8
3.1| 41495.2 4.0| 316226.2 30.4|
1 10 1 12| 820120.8|+1639591.4 +199.9| 1318749.6
160.8| 1555006.0 189.6| 1005052.9 122.5|
1 10 2 14| 851612.2|+1619177.8 +190.1| 927353.2
108.9| 1067711.2 125.4| 979289.7 115.0|
1 10 5 20| 850770.4|+1573741.5 +185.0| 501548.6
59.0| 596597.4 70.1| 821646.5 96.6|
1 10 10 30| 861287.6|+1595439.1 +185.2| 275914.5
32.0| 345409.0 40.1| 777486.8 90.3|
1 10 25 60| 837027.1|+1491381.2 +178.2| 119355.4
14.3| 150298.2 18.0| 586256.7 70.0|
1 10 100 210| 772620.9|+1251234.9 +161.9| 31937.0
4.1| 41554.4 5.4| 316189.0 40.9|
1 25 1 27| 458169.3| 1503483.5 328.2| 1298094.3
283.3|+1539391.2 +336.0| 903508.6 197.2|
1 25 2 29| 458989.2|+1490671.5 +324.8| 915198.1
199.4| 1034142.0 225.3| 861390.4 187.7|
1 25 5 35| 458773.1|+1471058.8 +320.7| 501442.3
109.3| 587883.6 128.1| 743133.4 162.0|
1 25 10 45| 462414.3|+1479716.8 +320.0| 283057.4
61.2| 348896.5 75.5| 765866.2 165.6|
1 25 25 75| 457351.6|+1429907.3 +312.6| 121225.8
26.5| 156807.2 34.3| 588809.1 128.7|
1 25 100 225| 432971.5|+1175534.2 +271.5| 32177.0
7.4| 41895.5 9.7| 301853.6 69.7|
1 100 1 102| 144919.5| 1130526.3 780.1| 1288674.2
889.2|+1543481.1 +1065.1| 892586.8 615.9|
1 100 2 104| 145676.2|+1161293.2 +797.2| 904949.9
621.2| 1039056.1 713.3| 860907.1 591.0|
1 100 5 110| 144050.6|+1127321.0 +782.6| 493589.1
342.6| 591349.8 410.5| 740179.2 513.8|
1 100 10 120| 146268.0|+1129848.2 +772.5| 280432.7
191.7| 348159.2 238.0| 765258.2 523.2|
1 100 25 150| 143834.8|+1056520.3 +734.5| 118337.4
82.3| 155110.3 107.8| 567786.9 394.7|
1 100 100 300| 143952.8| +922860.2 +641.1| 32202.6
22.4| 41905.6 29.1| 302929.3 210.4|
10 1 1 21| 528782.4| 893183.8 168.9| 1321008.8
249.8|+1553550.9 +293.8| 913725.5 172.8|
10 1 2 32| 394258.6| 852738.2 216.3| 913856.5
231.8|+1050503.7 +266.5| 859744.2 218.1|
10 1 5 65| 215308.3| +787900.3 +365.9| 494882.7
229.8| 603500.5 280.3| 742474.9 344.8|
10 1 10 120| 124251.0| 700292.8 563.6| 281195.7
226.3| 351778.7 283.1| +734899.3 +591.5|
10 1 25 285| 45218.1| 519323.5 1148.5| 122100.1
270.0| 155246.9 343.3| +562583.7 +1244.2|
10 1 100 1110| 9388.1| 223043.9 2375.8| 30162.0
321.3| 38781.0 413.1| +281476.3 +2998.2|
10 2 1 31| 424109.1| 869318.4 205.0| 1299544.4
306.4|+1533392.1 +361.6| 882680.4 208.1|
10 2 2 42| 307274.3| 839474.7 273.2| 917371.6
298.6|+1051529.4 +342.2| 863403.8 281.0|
10 2 5 75| 185983.8| +775564.3 +417.0| 497265.3
267.4| 603835.5 324.7| 743419.4 399.7|
10 2 10 130| 112609.7| 675451.1 599.8| 278571.4
247.4| 348152.3 309.2| +735167.5 +652.8|
10 2 25 295| 45285.2| 518512.4 1145.0| 119989.6
265.0| 151824.4 335.3| +579544.6 +1279.8|
10 2 100 1120| 9341.7| 221246.0 2368.4| 30107.0
322.3| 37328.6 399.6| +283455.4 +3034.3|
10 5 1 61| 224251.4| 818246.7 364.9| 1298200.5
578.9|+1530159.2 +682.3| 904004.8 403.1|
10 5 2 72| 196735.0| 790434.4 401.8| 846229.2
430.1|+1031049.9 +524.1| 780884.3 396.9|
10 5 5 105| 138580.8| 732656.0 528.7| 492956.3
355.7| 601118.7 433.8| +742693.5 +535.9|
10 5 10 160| 93825.9| 628881.6 670.3| 280007.8
298.4| 354010.7 377.3| +736628.3 +785.1|
10 5 25 325| 42383.1| 494662.2 1167.1| 117590.2
277.4| 147048.1 346.9| +557730.6 +1315.9|
10 5 100 1150| 9058.8| 219280.3 2420.6| 28384.1
313.3| 35916.9 396.5| +279448.2 +3084.8|
10 10 1 111| 137779.9| 720965.4 523.3| 1235600.9
896.8|+1486771.6 +1079.1| 898092.1 651.8|
10 10 2 122| 123282.4| 709133.9 575.2| 893166.0
724.5| +987447.1 +801.0| 838158.1 679.9|
10 10 5 155| 96949.7| 661054.1 681.9| 489928.3
505.3| 581166.4 599.5| +716649.8 +739.2|
10 10 10 210| 72653.1| 605407.5 833.3| 274979.8
378.5| 348327.4 479.4| +731943.1 +1007.4|
10 10 25 375| 37519.4| 466174.1 1242.5| 117381.8
312.9| 149268.3 397.8| +559221.6 +1490.5|
10 10 100 1200| 8852.0| 214408.8 2422.2| 23658.6
267.3| 28419.6 321.1| +246862.1 +2788.8|
10 25 1 261| 58768.2| 553643.6 942.1| 1258583.8
2141.6|+1462758.0 +2489.0| 845871.3 1439.3|
10 25 2 272| 57826.9| 549103.2 949.6| 849987.3
1469.9|+1003831.8 +1735.9| 815206.9 1409.7|
10 25 5 305| 51374.5| 517744.5 1007.8| 468698.6
912.3| 553291.0 1077.0| +704154.2 +1370.6|
10 25 10 360| 43997.3| 488085.7 1109.4| 271530.1
617.2| 335804.3 763.2| +722621.8 +1642.4|
10 25 25 525| 27927.7| 392185.6 1404.3| 118022.6
422.6| 147582.1 528.4| +565493.7 +2024.8|
10 25 100 1350| 8153.8| 190852.5 2340.7| 22239.0
272.7| 26769.3 328.3| +233509.2 +2863.8|
10 100 1 1011| 15695.9| 259241.0 1651.6| 1077068.5
6862.1|+1338756.8 +8529.3| 822100.9 5237.7|
10 100 2 1022| 15902.9| 252625.0 1588.6| 786361.5
4944.8| +885905.0 +5570.7| 807424.6 5077.2|
10 100 5 1055| 15313.0| 247028.6 1613.2| 368047.8
2403.5| 422452.3 2758.8| +657416.6 +4293.2|
10 100 10 1110| 14745.9| 241046.0 1634.7| 204743.0
1388.5| 239400.3 1623.5| +664549.1 +4506.7|
10 100 25 1275| 12245.3| 215672.4 1761.3| 91137.3
744.3| 101068.3 825.4| +482580.0 +3940.9|
10 100 100 2100| 5973.3| 140923.5 2359.2| 22359.4
374.3| 25842.7 432.6| +230186.3 +3853.6|
100 1 1 201| 71160.9| 165570.8 232.7| 1209681.7
1699.9|+1474622.5 +2072.2| 866177.7 1217.2|
100 1 2 302| 47319.1| 157226.6 332.3| 849791.6
1795.9| +990606.1 +2093.5| 825137.9 1743.8|
100 1 5 605| 22567.3| 136572.5 605.2| 465726.6
2063.7| 554461.5 2456.9| +699124.2 +3098.0|
100 1 10 1110| 12241.0| 111043.3 907.1| 200570.1
1638.5| 233323.9 1906.1| +642948.1 +5252.4|
100 1 25 2625| 4464.0| 72398.5 1621.8| 82920.7
1857.6| 97895.8 2193.0| +457639.0 +10251.8|
100 1 100 10200| 860.1| 24847.9 2889.0| 18152.2
2110.5| 18367.4 2135.5| +180327.4 +20966.2|
100 2 1 301| 46815.9| 160696.6 343.3| 1260595.5
2692.7|+1455222.9 +3108.4| 863145.8 1843.7|
100 2 2 402| 35447.5| 150768.2 425.3| 872033.3
2460.1|+1006330.9 +2838.9| 827931.8 2335.7|
100 2 5 705| 19587.2| 131168.8 669.7| 464567.6
2371.8| 545684.9 2785.9| +688526.5 +3515.2|
100 2 10 1210| 11037.0| 108582.0 983.8| 215955.9
1956.7| 240021.9 2174.7| +638698.9 +5786.9|
100 2 25 2725| 4232.9| 71036.1 1678.2| 82735.3
1954.6| 98670.5 2331.0| +449662.3 +10623.1|
100 2 100 10300| 851.9| 24643.1 2892.6| 17611.6
2067.2| 18479.8 2169.2| +175928.2 +20650.4|
100 5 1 601| 25265.2| 144441.8 571.7| 1163740.5
4606.1|+1436733.4 +5686.6| 843670.5 3339.3|
100 5 2 702| 21464.1| 135706.9 632.3| 833619.4
3883.8| +945707.9 +4406.0| 787369.9 3668.3|
100 5 5 1005| 14347.0| 119614.7 833.7| 428651.5
2987.7| 523296.4 3647.4| +682096.7 +4754.3|
100 5 10 1510| 9354.5| 99791.9 1066.8| 201244.3
2151.3| 235072.9 2512.9| +637732.7 +6817.4|
100 5 25 3025| 3786.6| 67911.3 1793.5| 80066.9
2114.5| 93937.6 2480.8| +437053.6 +11542.1|
100 5 100 10600| 827.4| 24141.8 2917.7| 17014.4
2056.3| 19307.6 2333.4| +173173.4 +20929.0|
100 10 1 1101| 14297.8| 120438.9 842.4| 1023704.6
7159.9|+1165436.1 +8151.1| 810992.0 5672.1|
100 10 2 1202| 13069.0| 115188.5 881.4| 707840.9
5416.2| +813981.7 +6228.4| 763229.5 5840.0|
100 10 5 1505| 10118.7| 102630.8 1014.3| 356061.3
3518.9| 387553.8 3830.1| +641697.9 +6341.7|
100 10 10 2010| 7321.0| 89036.4 1216.2| 199950.9
2731.2| 223099.1 3047.4| +633412.2 +8652.0|
100 10 25 3525| 3549.8| 61546.7 1733.8| 79029.9
2226.3| 90370.9 2545.8| +429170.4 +12090.0|
100 10 100 11100| 748.7| 23472.5 3134.9| 15912.5
2125.2| 19193.9 2563.5| +170810.7 +22812.9|
100 25 1 2601| 6134.5| 83747.1 1365.2| 1002307.0
16338.7|+1048943.8 +17099.0| 773842.2 12614.5|
100 25 2 2702| 6022.5| 80812.2 1341.8| 690373.8
11463.3| +789307.9 +13106.0| 734616.4 12197.9|
100 25 5 3005| 5290.0| 74144.5 1401.6| 347291.3
6565.1| 388696.0 7347.8| +590149.9 +11156.0|
100 25 10 3510| 4377.8| 67076.1 1532.2| 186616.1
4262.8| 217718.5 4973.2| +594861.4 +13588.1|
100 25 25 5025| 2417.7| 49032.7 2028.1| 67341.0
2785.3| 84457.0 3493.3| +404227.5 +16719.4|
100 25 100 12600| 760.2| 20921.5 2752.0| 14262.1
1876.0| 18742.6 2465.4| +150987.3 +19860.9|
100 100 1 10101| 1540.9| 31347.3 2034.4| 686419.2
44547.7| +812736.2 +52745.5| 563080.5 36543.2|
100 100 2 10202| 1599.6| 30255.6 1891.4| 512547.8
32041.4| 568231.7 35522.4| +573178.2 +35831.7|
100 100 5 10505| 1556.1| 30008.5 1928.4| 246167.4
15819.0| 295721.0 19003.4| +438022.6 +28147.9|
100 100 10 11010| 1473.0| 28154.9 1911.3| 123781.7
8403.1| 158667.0 10771.4| +422046.3 +28651.3|
100 100 25 12525| 1214.5| 24826.4 2044.1| 57454.1
4730.6| 53768.6 4427.1| +285759.8 +23528.5|
100 100 100 20100| 562.8| 14887.9 2645.4| 9575.2
1701.4| 10747.1 1909.6| +112829.4 +20048.4|
1000 1 1 2001| 7569.6| 18967.7 250.6| 1000978.7
13223.6|+1080332.6 +14271.9| 771630.1 10193.7|
1000 1 2 3002| 4826.5| 17037.4 353.0| 666101.8
13800.8| +757023.3 +15684.6| 724266.7 15005.9|
1000 1 5 6005| 2336.2| 15062.9 644.8| 303254.6
12980.7| 334139.1 14302.7| +538101.4 +23033.2|
1000 1 10 11010| 1220.0| 11970.2 981.2| 138316.2
11337.5| 148179.3 12145.9| +408164.4 +33456.3|
1000 1 25 26025| 443.7| 7623.2 1718.3| 34113.0
7689.1| 30913.0 6967.8| +177876.3 +40093.4|
1000 1 100 101100| 84.3| 2468.9 2928.5| 2571.5
3050.1| 2859.8 3392.1| +13884.3 +16468.7|
1000 2 1 3001| 4905.2| 18267.7 372.4| 993230.1
20248.7|+1029848.9 +20995.2| 759556.4 15484.8|
1000 2 2 4002| 3555.7| 16763.4 471.4| 629670.4
17708.6| +690171.9 +19410.1| 676033.7 19012.5|
1000 2 5 7005| 1991.1| 14572.6 731.9| 301237.7
15129.0| 307670.9 15452.1| +490246.8 +24621.6|
1000 2 10 12010| 1108.0| 11563.9 1043.7| 126427.0
11410.7| 136701.5 12338.0| +414599.8 +37419.7|
1000 2 25 27025| 432.4| 7487.6 1731.8| 33016.2
7636.3| 33746.7 7805.3| +179156.7 +41437.1|
1000 2 100 102100| 83.4| 2461.1 2950.2| 2452.5
2939.8| 2422.0 2903.2| +13665.8 +16381.2|
1000 5 1 6001| 2582.6| 16092.1 623.1| 834306.9
32304.6| +893998.4 +34615.9| 684801.2 26515.7|
1000 5 2 7002| 2190.9| 14064.5 642.0| 566604.2
25862.0| 605906.5 27655.9| +622503.9 +28413.5|
1000 5 5 10005| 1468.3| 13074.6 890.5| 258037.6
17574.3| 308088.0 20983.1| +444225.3 +30255.1|
1000 5 10 15010| 929.6| 10634.7 1144.0| 114688.9
12337.4| 127073.2 13669.6| +347484.4 +37379.7|
1000 5 25 30025| 402.6| 7036.0 1747.5| 29048.0
7214.5| 30214.3 7504.2| +162313.3 +40313.1|
1000 5 100 105100| 82.3| 2402.8 2919.4| 2360.9
2868.4| 2589.4 3146.1| +12952.8 +15737.6|
1000 10 1 11001| 1445.0| 13367.3 925.1| +683761.0
+47318.3| 675209.4 46726.5| 562329.9 38914.9|
1000 10 2 12002| 1309.7| 12439.2 949.7| 483623.4
36925.1| 468215.2 35748.7| +493636.6 +37689.6|
1000 10 5 15005| 1020.7| 11027.6 1080.4| 202199.3
19809.6| 213994.4 20965.1| +343494.6 +33652.3|
1000 10 10 20010| 709.5| 8101.9 1142.0| 84429.2
11900.5| 89562.1 12624.0| +298947.9 +42137.5|
1000 10 25 35025| 359.5| 6504.4 1809.3| 23864.3
6638.3| 26191.8 7285.7| +148658.8 +41352.0|
1000 10 100 110100| 77.4| 2339.1 3023.4| 2384.8
3082.5| 2237.6 2892.2| +12432.5 +16069.4|
1000 25 1 26001| 623.4| 8975.4 1439.7| +414136.0
+66428.3| 392230.0 62914.6| 331792.3 53220.2|
1000 25 2 27002| 602.3| 8387.7 1392.6| 269179.2
44690.8| 273939.6 45481.1| +324980.3 +53955.2|
1000 25 5 30005| 532.8| 7839.3 1471.5| 126420.4
23729.5| 135093.8 25357.5| +221663.1 +41606.8|
1000 25 10 35010| 440.1| 6948.5 1578.8| 63235.6
14367.5| 64159.0 14577.4| +202311.2 +45966.5|
1000 25 25 50025| 271.1| 5203.6 1919.4| 21312.3
7861.3| 21140.1 7797.8| +110040.4 +40589.7|
1000 25 100 125100| 75.1| 2111.2 2811.5| 1952.8
2600.5| 2060.8 2744.4| +12081.9 +16089.5|
1000 100 1 101001| 162.0| 3203.9 1977.3| 116682.2
72011.6| +125619.4 +77527.2| 118859.9 73355.6|
1000 100 2 102002| 159.8| 3077.3 1925.9| 79104.9
49505.6| 85925.3 53773.9| +120926.8 +75678.6|
1000 100 5 105005| 156.6| 3012.6 1924.3| 40502.8
25871.7| 39483.2 25220.4| +75288.6 +48091.5|
1000 100 10 110010| 146.2| 2839.9 1942.2| 22170.3
15161.9| 23012.8 15738.1| +70169.8 +47988.0|
1000 100 25 125025| 122.0| 2513.4 2059.8| 7832.6
6419.0| 8531.2 6991.5| +44494.1 +36463.8|
1000 100 100 200100| 55.9| 1501.8 2687.2| 1260.1
2254.7| 1274.9 2281.3| +6722.1 +12028.3|

What you can see is that the naive strategy is only the best strategy when
the string is very short and has few space/non-space sequences. As the
string length rises the strategies that avoid doing \s+ and instead remove
a fixed number of whitespace characters from the end of the string are
actually faster, even if they have a high overhead. You can see that
effectively the speed of the "loop" strategies are dominated by the number
of spaces at the right and run independently of the length of the string
(loop and loop_chop are heavily dependent on the number of spaces on the
right, loop2 is smarter and reduces that cost significantly). Both the
naive and separate approaches are run-time proportional to the length of
the string, for naive the use of an alternation provides terrible
performance for sequences of space/non-space, and the s/\s+\z// forces the
"separate" function to be run time proportional to the length as well. What
all this shows is that a properly implemented trim/trim function in XS
would be *massively* faster than all of this.It would be able to do a very
low overhead walk from the right to ensure that the performance is
completely dominated by the number of spaces it needs to remove which I
guess would be as efficient it can be made to be.

I note that if you consider rtrimming sentences, most fo the sentences in
this mail would be of a type and structure that most users would benefit
from using the loop2 strategy, not the commonly recommended separate
strategy.

Which just proves the point, most people, even the experts like myself and
people on this list do not implement rtrim efficiently. In fact, it's quite
hard to do so.

cheers,
Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
Inspired by the excellent example of *demerphq* : the attached Perl program
and output compare the performance of Char::Replace::trim - an XS module
for trimming strings found on CPAN with various combinations of Perl
operators to see which is fastest. In most cases, *trim* is faster but not
always and not always that much faster: using *substr* and *chop* produces
excellent results in pure Perl and is quick and easy to implement and
document. I urge that this shows that the Perl ecosystem works well as is
- in the highly unlikely that one really needs a faster trim function there
are good solutions immediately available on CPAN.

Run times for various trim methods
Column Description
1 Length2 - Log2 of the total length of the string being tested
2 Repeats - The number of times the string was repeated
3 Text - The number of text characters per repetition
4 Spaces - The number of spaces per repetition
5 _
6 ChopRe - see attached code
7 _
8 ChopSub - see attached code
9 _
10 ReBlocks - see attached code
11 _
12 Trim - From Char::Replace on CPAN
13 _
14 loop - see attached code
15 _
16 regExp - see attached code
17 _
18 reverse - see attached code
19 _
Length2 Repeats Text Spaces _ ChopRe _ ChopSub _
ReBlocks _ Trim _ loop _ regExp _
reverse _
1 1 1 1 1 246 125
417 100 Trim 277 217
227
2 4 1 1 10 255 128
541 100 Trim 297 245
268
3 4 1 10 1 1419 486
552 100 Trim 1763 206
239
4 5 1 10 10 1353 463
674 100 Trim 1900 237
254
5 5 10 1 1 250 127
592 100 Trim 310 519
273
6 7 1 1 100 244 127
675 100 Trim 326 361
317
7 7 1 10 100 1269 441
765 100 Trim 1980 348
299
8 7 1 100 1 9332 3041
554 100 Trim 13590 189
237
9 7 1 100 10 8116 2642
578 100 Trim 11983 182
242
10 7 10 1 10 253 129
706 100 Trim 332 625
332
11 7 10 10 1 1366 486
854 100 Trim 2012 645
316
12 8 1 100 100 9079 2935
763 100 Trim 15321 283
277
13 8 10 10 10 1388 502
949 100 Trim 2039 749
384
14 8 100 1 1 241 121
738 100 Trim 314 2935
374
15 10 1 1 1000 247 155
800 100 Trim 391 1158
663
16 10 1 10 1000 1414 457
968 100 Trim 2422 1152
634
17 10 1 1000 1 28830 8717
403 100 Trim 47841 157
226
18 10 1 1000 10 27623 8195
423 100 Trim 46086 159
205
19 10 10 1 100 246 124
791 100 Trim 375 1492
679
20 10 10 100 1 9494 2819
892 100 Trim 18357 1517
496
21 11 1 100 1000 12745 2812
928 99 Trim 18448 895
538
22 11 1 1000 100 30493 8765
484 100 Trim 50938 199
262
23 11 1 1000 1000 41575 8327
501 100 Trim 59417 363
305
24 11 10 10 100 1760 376
835 100 Trim 2059 1261
600
25 11 10 100 10 12970 2860
1011 99 Trim 19679 1549
543
26 11 10 100 100 9931 2053
704 100 Trim 13581 1514
528
27 11 100 1 10 259 102
664 100 Trim 351 2848
568
28 11 100 10 1 1568 354
822 100 Trim 1970 3178
578
29 11 100 10 10 1615 409
897 100 Trim 2366 4220
883
30 11 1000 1 1 231 137
624 100 Trim 331 19780
787
31 12 1 1 4000 206 110
652 100 Trim 256 2494
1140
32 12 1 10 4000 1556 469
951 100 Trim 2250 2649
1294
33 12 1 4000 1 49159 10215
269 100 Trim 68433 154
208
34 12 1 4000 10 47735 9938
279 100 Trim 68866 152
208
35 13 1 100 4000 12089 2290
812 100 Trim 16129 2202
1100
36 13 1 1000 4000 40840 7090
489 100 Trim 53201 781
459
37 13 1 4000 100 48297 9865
278 100 Trim 68292 162
209
38 13 1 4000 1000 54980 10249
326 100 Trim 79560 217
237
39 13 1 4000 4000 57937 9893
321 100 Trim 93951 397
290
40 13 4000 1 1 221 121
525 100 Trim 298 58132
1912
41 14 10 1 1000 189 148
549 100 Trim 325 4822
2137
42 14 10 10 1000 1700 309
793 100 Trim 2600 4994
2203
43 14 10 100 1000 8142 1156
593 100 Trim 13503 3128
1356
44 14 10 1000 1 51155 7387
630 100 Trim 81234 2983
865
45 14 10 1000 10 42783 6181
547 100 Trim 66705 2425
704
46 14 10 1000 100 47306 6740
675 100 Trim 81689 2861
898
47 14 100 1 100 189 110
530 100 Trim 278 5660
2000
48 14 100 10 100 1470 281
707 100 Trim 2216 6388
2482
49 14 100 100 1 12119 1771
885 100 Trim 14386 8723
1864
50 14 100 100 10 10570 1538
880 100 Trim 15773 7894
1712
51 14 1000 1 10 193 138
483 100 Trim 229 16786
2187
52 14 1000 10 1 2267 300
1328 100 Trim 2853 19603
2115
53 15 10 1000 1000 58146 4909
715 100 Trim 107771 3066
1025
54 15 100 100 100 10847 1019
731 100 Trim 19810 6576
1842
55 15 1000 10 10 1189 185
498 100 Trim 1869 10430
1758
56 16 10 1 4000 158 100
ChopSub 195 130 251 4660
2125
57 16 10 10 4000 1129 154
703 100 Trim 1752 4619
2132
58 16 10 100 4000 11105 603
764 100 Trim 10556 4800
2239
59 16 10 1000 4000 69749 3179
1297 99 Trim 137039 4170
1906
60 16 10 4000 1 135424 7419
647 99 Trim 159262 2889
819
61 16 10 4000 10 128436 7012
625 100 Trim 267381 2838
798
62 16 10 4000 100 139363 7306
666 100 Trim 144710 2922
821
63 16 10 4000 1000 148196 6850
938 99 Trim 302290 3097
1004
64 16 4000 1 10 132 100
ChopSub 200 103 213 15932
2226
65 16 4000 10 1 1106 145
523 100 Trim 3900 21897
7043
66 17 10 4000 4000 159879 4441
955 100 Trim 305220 2733
1068
67 17 100 1 1000 119 100
ChopSub 292 115 333 5277
2238
68 17 100 10 1000 1135 133
519 100 Trim 2290 5137
2386
69 17 100 100 1000 10682 289
492 100 Trim 11534 5489
2280
70 17 100 1000 1 57759 1325
934 100 Trim 121078 5346
1384
71 17 100 1000 10 75212 1740
1129 100 Trim 165059 7381
1763
72 17 100 1000 100 84757 1636
1155 100 Trim 164857 7287
1810
73 17 1000 1 100 117 100
ChopSub 152 106 233 6515
2189
74 17 1000 10 100 1117 130
512 100 Trim 1082 7150
2313
75 17 1000 100 1 9814 302
746 100 Trim 18998 10822
2127
76 17 1000 100 10 9011 280
700 100 Trim 20691 10396
2139
77 17 4000 10 10 885 99
ChopSub 352 110 1561 10488
1747
78 18 100 1000 1000 92640 1069
1269 100 Trim 196978 6120
1956
79 18 1000 100 100 7049 133
480 100 Trim 14344 5089
1556
80 19 100 1 4000 995 100
ChopSub 578 573 692 5200
3288
81 19 100 10 4000 975 103
1445 100 Trim 3974 3977
3145
82 19 100 100 4000 10116 142
1278 100 Trim 21154 4144
2011
83 19 100 1000 4000 64348 290
2167 100 Trim 121304 3091
1631
84 19 100 4000 1 174746 831
451 100 Trim 177494 3246
911
85 19 100 4000 10 252262 1286
1208 100 Trim 446608 4692
1256
86 19 100 4000 100 304619 1384
1731 100 Trim 301171 5596
1865
87 19 100 4000 1000 265711 1066
1877 100 Trim 523364 4595
1622
88 19 4000 1 100 151 100
ChopSub 485 140 257 5538
2159
89 19 4000 10 100 1049 110
545 100 Trim 2064 5813
2290
90 19 4000 100 1 9269 145
754 100 Trim 11121 8589
1874
91 19 4000 100 10 9295 132
777 100 Trim 18379 8189
1860
92 20 100 4000 4000 39322 100
ChopSub 369 114 80856 697
207
93 20 1000 1 1000 200 100
ChopSub 1939 157 1170 3954
1924
94 20 1000 10 1000 1248 99
ChopSub 299 264 2186 4331
1875
95 20 1000 1000 1 55051 180
795 100 Trim 108659 4060
1250
96 20 1000 1000 10 41394 117
803 100 Trim 81684 3150
886
97 20 4000 100 100 8627 109
1331 100 Trim 17604 5916
1695
98 21 1000 100 1000 8288 99
ChopSub 859 106 16265 3756
1745
99 21 1000 1000 100 66112 182
1288 100 Trim 64338 5254
1486
100 21 1000 1000 1000 56151 128
975 100 Trim 139127 3171
1060
101 22 1000 1 4000 413 100
ChopSub 773 381 505 1851
1365
102 22 1000 10 4000 985 99
ChopSub 1022 102 3312 1848
1302
103 22 1000 100 4000 8352 102
1183 100 Trim 8985 1318
721
104 22 1000 4000 1 379598 165
956 100 Trim 351658 2587
844
105 22 1000 4000 10 333532 141
1426 100 Trim 783625 2384
745
106 22 1000 4000 100 341259 134
693 100 Trim 786148 2247
782
107 22 4000 1 1000 154 100
ChopSub 112 105 115 1554
871
108 22 4000 10 1000 1187 104
339 100 Trim 2460 1533
903
109 22 4000 1000 1 71744 140
1084 100 Trim 174930 2092
608
110 22 4000 1000 10 72050 124
994 100 Trim 168782 1944
649
111 23 1000 1000 4000 188658 142
3669 100 Trim 188665 2369
1611
112 23 1000 4000 1000 639435 172
2454 100 Trim 1262932 2941
992
113 23 1000 4000 4000 341244 100
ChopSub 1572 272 339640 1440
976
114 23 4000 100 1000 9168 100
ChopSub 733 125 21504 1462
738
115 23 4000 1000 100 82899 100
ChopSub 1115 110 159155 1978
635
116 23 4000 1000 1000 106559 101
663 100 Trim 106304 1685
706
117 24 4000 1 4000 100 ChopRe 134
212 100 Trim 471 1623
1232
118 24 4000 10 4000 1053 100
ChopSub 542 115 2019 1208
950
119 24 4000 100 4000 10520 102
1383 100 Trim 10784 1229
688
120 24 4000 4000 1 378399 107
1421 100 Trim 380352 2041
638
121 24 4000 4000 10 398512 103
2190 100 Trim 835319 2087
655
122 24 4000 4000 100 428371 113
1507 100 Trim 413063 2144
681
123 25 4000 1000 4000 103058 107
2235 100 Trim 207503 1369
767
124 25 4000 4000 1000 449413 119
1486 100 Trim 869797 2029
697
125 25 4000 4000 4000 394193 100
ChopSub 1660 320 1241261 1774
1650
Finished in:246.34 seconds
ok 1 - ChopRe
ok 2 - Trim
ok 3 - regExp
ok 4 - reverse
ok 5 - ChopSub
ok 6 - loop
ok 7 - ReBlocks
1..7


On Tue, Jun 1, 2021 at 7:59 AM demerphq <demerphq@gmail.com> wrote:

> On Sat, 29 May 2021 at 09:56, demerphq <demerphq@gmail.com> wrote:
> >
> > On Sat, 29 May 2021 at 00:52, Joseph Brenner <doomvox@gmail.com> wrote:
> > >
> > > Some quick-and-dirty benchmarking, trimming 100,000 short strings:
> ...
> > > However: I took it very easy on this case using short lines... it's
> > > very sensitive to line length (that \g is checking every point in the
> > > string) and it slows down by a factor of ten with lines that are only
> > > around 80 chars long.
> >
> > THIS is the key point here. Run your benchmarks over strings of length
> > 1, 10, 100, 1000, and include the examples I posted in another mail:
>
> I put the following together. It benchmarks various techniques for
> trimming strings at different string lengths and composition.
>
> $ cat trim.pl
> use strict;
> use warnings;
> use Benchmark qw(cmpthese timethese :hireswallclock);
> use Test::More;
> my $base= 'naive';
> my @extra= qw(separate loop loop_chop loop2);
> my @keys= ($base,@extra);
> $|++;
> printf "%4s %3s %3s %10s|%10s|".("%10s %10s|" x @extra)."\n",
> "reps","ns","sp","len", $base, map { $_ , "as pct" } @extra;
> printf "%.4s-%.3s-%.3s-%.10s+%.10s+".("%.10s-%.10s+" x @extra)."\n",
> ("-" x 10) x (5+2*@extra);
> foreach my $segments (1,10,100,1000) {
> foreach my $ns_len (1,2,5,10,25,100) {
> foreach my $sp_len (1,2,5,10,25,100) {
> my $descr= "segments: $segments non-space length: $ns_len
> space length: $sp_len";
> my $string= (" " x $sp_len) . ((("x" x $ns_len) . (" " x
> $sp_len))x$segments);
> my ($naive,$separate,$loop,$loop2,$loop_chop);
> #diag "timing $descr\n";
> my $str_len= length $string;
> my $r= timethese -1, {
> naive => sub { $naive= $string; $naive=~s/\A\s+|\s+\z//g;
> },
> separate => sub { $separate= $string;
> $separate=~s/\A\s+//; $separate=~s/\s+\z//; },
> loop => sub { $loop= $string; $loop=~s/\A\s+//; 1 while
> $loop=~s/\s\z//; },
> loop2 => sub {
> $loop2= $string;
> $loop2=~s/\A\s+//;
> 1 while
> $loop2=~s/\s{16}\z//;
> $loop2=~s/\s{8}\z//;
> $loop2=~s/\s{4}\z//;
> $loop2=~s/\s{2}\z//;
> $loop2=~s/\s{1}\z//;
> },
> loop_chop => sub {
> $loop_chop= $string;
> $loop_chop=~s/\A\s+//;
> chop($loop_chop) while $loop_chop=~m/\s\z/;
> },
> }, "none";
> my @key= ($segments,$ns_len,$sp_len,$str_len);
> my %rps;
> my $max;
> my $max_name;
> foreach my $name (@keys) {
> $rps{$name}= $r->{$name}->iters/$r->{$name}->real;
> if (!defined $max or $max < $rps{$name}) {
> $max= $rps{$name};
> $max_name= $name;
> }
> }
> my @data;
> foreach my $name (@keys) {
> my $fmt= $name eq $max_name ? "+" : "";
> push @data, sprintf "%$fmt.1f",$rps{$name};
> push @data, sprintf "%$fmt.1f",$rps{$name}/$rps{naive}*100
> if $name ne "naive";
> }
> printf "%4d %3d %3d %10d|%10s|". ("%10s %10s|" x @extra) .
> "\n", @key, @data;
> $ENV{CHECK} and ok(
> $naive &&
> $naive eq $separate &&
> $naive eq $loop &&
> $naive eq $loop2 &&
> $naive eq $loop_chop, "all results the same - $descr"
> );
> }
> }
> }
>
> It produces the following report. The left side shows the composition of
> the string, and its length. The next column is timing for the naive
> s/\A\s+|\s+\z//g approach. The following four columns contain data for each
> other comparison strategy. "separate" is standard recommended "less worse
> way" of using two s/\A\s+// and s/\s+\z//. The rest are solutions I ginned
> up knowing how the regex engine works to optimize the separate strategy.
> The strategy that is the +best+ for any row is prefixed with a + sign.
>
>
> reps ns sp len| naive| separate as pct| loop as
> pct| loop_chop as pct| loop2 as pct|
>
> -----------------------+----------+---------------------+---------------------+---------------------+---------------------+
> 1 1 1 3|+1757705.9| 1722645.2 98.0| 1346754.4
> 76.6| 1460137.6 83.1| 1234795.8 70.3|
> 1 1 2 5|+1767954.3| 1727402.3 97.7| 938354.5
> 53.1| 1069422.3 60.5| 1220935.1 69.1|
> 1 1 5 11|+1795476.6| 1728537.8 96.3| 500068.3
> 27.9| 594498.6 33.1| 914134.5 50.9|
> 1 1 10 21|+1802973.3| 1668560.7 92.5| 276854.3
> 15.4| 344098.8 19.1| 902688.3 50.1|
> 1 1 25 51|+1720894.0| 1547221.8 89.9| 119435.9
> 6.9| 150625.4 8.8| 685213.9 39.8|
> 1 1 100 201|+1418034.7| 1302023.4 91.8| 31939.3
> 2.3| 41388.1 2.9| 340764.2 24.0|
> 1 2 1 4| 1575700.7|+1695328.2 +107.6| 1336772.1
> 84.8| 1467319.5 93.1| 1230853.2 78.1|
> 1 2 2 6| 1581974.8|+1705458.9 +107.8| 928325.3
> 58.7| 1067259.2 67.5| 1058661.8 66.9|
> 1 2 5 12| 1624738.2|+1724010.4 +106.1| 499957.4
> 30.8| 573393.5 35.3| 922924.4 56.8|
> 1 2 10 22| 1628322.0|+1645636.7 +101.1| 276198.2
> 17.0| 342247.1 21.0| 821484.7 50.4|
> 1 2 25 52|+1549776.4| 1538065.2 99.2| 119481.1
> 7.7| 148029.2 9.6| 691068.5 44.6|
> 1 2 100 202|+1306857.0| 1301676.6 99.6| 31817.4
> 2.4| 41587.5 3.2| 323718.2 24.8|
> 1 5 1 7| 1185669.6|+1691598.2 +142.7| 1330096.1
> 112.2| 1452426.8 122.5| 1097320.8 92.5|
> 1 5 2 9| 1453834.2|+2041745.4 +140.4| 1111872.3
> 76.5| 1140493.7 78.4| 1209036.7 83.2|
> 1 5 5 15| 1115944.2|+1646570.6 +147.5| 493371.7
> 44.2| 567321.4 50.8| 824512.2 73.9|
> 1 5 10 25| 1206617.8|+1643729.1 +136.2| 279888.0
> 23.2| 346755.6 28.7| 845376.3 70.1|
> 1 5 25 55| 1184689.4|+1510205.0 +127.5| 118686.9
> 10.0| 149178.5 12.6| 616426.3 52.0|
> 1 5 100 205| 1039192.6|+1270575.0 +122.3| 31737.8
> 3.1| 41495.2 4.0| 316226.2 30.4|
> 1 10 1 12| 820120.8|+1639591.4 +199.9| 1318749.6
> 160.8| 1555006.0 189.6| 1005052.9 122.5|
> 1 10 2 14| 851612.2|+1619177.8 +190.1| 927353.2
> 108.9| 1067711.2 125.4| 979289.7 115.0|
> 1 10 5 20| 850770.4|+1573741.5 +185.0| 501548.6
> 59.0| 596597.4 70.1| 821646.5 96.6|
> 1 10 10 30| 861287.6|+1595439.1 +185.2| 275914.5
> 32.0| 345409.0 40.1| 777486.8 90.3|
> 1 10 25 60| 837027.1|+1491381.2 +178.2| 119355.4
> 14.3| 150298.2 18.0| 586256.7 70.0|
> 1 10 100 210| 772620.9|+1251234.9 +161.9| 31937.0
> 4.1| 41554.4 5.4| 316189.0 40.9|
> 1 25 1 27| 458169.3| 1503483.5 328.2| 1298094.3
> 283.3|+1539391.2 +336.0| 903508.6 197.2|
> 1 25 2 29| 458989.2|+1490671.5 +324.8| 915198.1
> 199.4| 1034142.0 225.3| 861390.4 187.7|
> 1 25 5 35| 458773.1|+1471058.8 +320.7| 501442.3
> 109.3| 587883.6 128.1| 743133.4 162.0|
> 1 25 10 45| 462414.3|+1479716.8 +320.0| 283057.4
> 61.2| 348896.5 75.5| 765866.2 165.6|
> 1 25 25 75| 457351.6|+1429907.3 +312.6| 121225.8
> 26.5| 156807.2 34.3| 588809.1 128.7|
> 1 25 100 225| 432971.5|+1175534.2 +271.5| 32177.0
> 7.4| 41895.5 9.7| 301853.6 69.7|
> 1 100 1 102| 144919.5| 1130526.3 780.1| 1288674.2
> 889.2|+1543481.1 +1065.1| 892586.8 615.9|
> 1 100 2 104| 145676.2|+1161293.2 +797.2| 904949.9
> 621.2| 1039056.1 713.3| 860907.1 591.0|
> 1 100 5 110| 144050.6|+1127321.0 +782.6| 493589.1
> 342.6| 591349.8 410.5| 740179.2 513.8|
> 1 100 10 120| 146268.0|+1129848.2 +772.5| 280432.7
> 191.7| 348159.2 238.0| 765258.2 523.2|
> 1 100 25 150| 143834.8|+1056520.3 +734.5| 118337.4
> 82.3| 155110.3 107.8| 567786.9 394.7|
> 1 100 100 300| 143952.8| +922860.2 +641.1| 32202.6
> 22.4| 41905.6 29.1| 302929.3 210.4|
> 10 1 1 21| 528782.4| 893183.8 168.9| 1321008.8
> 249.8|+1553550.9 +293.8| 913725.5 172.8|
> 10 1 2 32| 394258.6| 852738.2 216.3| 913856.5
> 231.8|+1050503.7 +266.5| 859744.2 218.1|
> 10 1 5 65| 215308.3| +787900.3 +365.9| 494882.7
> 229.8| 603500.5 280.3| 742474.9 344.8|
> 10 1 10 120| 124251.0| 700292.8 563.6| 281195.7
> 226.3| 351778.7 283.1| +734899.3 +591.5|
> 10 1 25 285| 45218.1| 519323.5 1148.5| 122100.1
> 270.0| 155246.9 343.3| +562583.7 +1244.2|
> 10 1 100 1110| 9388.1| 223043.9 2375.8| 30162.0
> 321.3| 38781.0 413.1| +281476.3 +2998.2|
> 10 2 1 31| 424109.1| 869318.4 205.0| 1299544.4
> 306.4|+1533392.1 +361.6| 882680.4 208.1|
> 10 2 2 42| 307274.3| 839474.7 273.2| 917371.6
> 298.6|+1051529.4 +342.2| 863403.8 281.0|
> 10 2 5 75| 185983.8| +775564.3 +417.0| 497265.3
> 267.4| 603835.5 324.7| 743419.4 399.7|
> 10 2 10 130| 112609.7| 675451.1 599.8| 278571.4
> 247.4| 348152.3 309.2| +735167.5 +652.8|
> 10 2 25 295| 45285.2| 518512.4 1145.0| 119989.6
> 265.0| 151824.4 335.3| +579544.6 +1279.8|
> 10 2 100 1120| 9341.7| 221246.0 2368.4| 30107.0
> 322.3| 37328.6 399.6| +283455.4 +3034.3|
> 10 5 1 61| 224251.4| 818246.7 364.9| 1298200.5
> 578.9|+1530159.2 +682.3| 904004.8 403.1|
> 10 5 2 72| 196735.0| 790434.4 401.8| 846229.2
> 430.1|+1031049.9 +524.1| 780884.3 396.9|
> 10 5 5 105| 138580.8| 732656.0 528.7| 492956.3
> 355.7| 601118.7 433.8| +742693.5 +535.9|
> 10 5 10 160| 93825.9| 628881.6 670.3| 280007.8
> 298.4| 354010.7 377.3| +736628.3 +785.1|
> 10 5 25 325| 42383.1| 494662.2 1167.1| 117590.2
> 277.4| 147048.1 346.9| +557730.6 +1315.9|
> 10 5 100 1150| 9058.8| 219280.3 2420.6| 28384.1
> 313.3| 35916.9 396.5| +279448.2 +3084.8|
> 10 10 1 111| 137779.9| 720965.4 523.3| 1235600.9
> 896.8|+1486771.6 +1079.1| 898092.1 651.8|
> 10 10 2 122| 123282.4| 709133.9 575.2| 893166.0
> 724.5| +987447.1 +801.0| 838158.1 679.9|
> 10 10 5 155| 96949.7| 661054.1 681.9| 489928.3
> 505.3| 581166.4 599.5| +716649.8 +739.2|
> 10 10 10 210| 72653.1| 605407.5 833.3| 274979.8
> 378.5| 348327.4 479.4| +731943.1 +1007.4|
> 10 10 25 375| 37519.4| 466174.1 1242.5| 117381.8
> 312.9| 149268.3 397.8| +559221.6 +1490.5|
> 10 10 100 1200| 8852.0| 214408.8 2422.2| 23658.6
> 267.3| 28419.6 321.1| +246862.1 +2788.8|
> 10 25 1 261| 58768.2| 553643.6 942.1| 1258583.8
> 2141.6|+1462758.0 +2489.0| 845871.3 1439.3|
> 10 25 2 272| 57826.9| 549103.2 949.6| 849987.3
> 1469.9|+1003831.8 +1735.9| 815206.9 1409.7|
> 10 25 5 305| 51374.5| 517744.5 1007.8| 468698.6
> 912.3| 553291.0 1077.0| +704154.2 +1370.6|
> 10 25 10 360| 43997.3| 488085.7 1109.4| 271530.1
> 617.2| 335804.3 763.2| +722621.8 +1642.4|
> 10 25 25 525| 27927.7| 392185.6 1404.3| 118022.6
> 422.6| 147582.1 528.4| +565493.7 +2024.8|
> 10 25 100 1350| 8153.8| 190852.5 2340.7| 22239.0
> 272.7| 26769.3 328.3| +233509.2 +2863.8|
> 10 100 1 1011| 15695.9| 259241.0 1651.6| 1077068.5
> 6862.1|+1338756.8 +8529.3| 822100.9 5237.7|
> 10 100 2 1022| 15902.9| 252625.0 1588.6| 786361.5
> 4944.8| +885905.0 +5570.7| 807424.6 5077.2|
> 10 100 5 1055| 15313.0| 247028.6 1613.2| 368047.8
> 2403.5| 422452.3 2758.8| +657416.6 +4293.2|
> 10 100 10 1110| 14745.9| 241046.0 1634.7| 204743.0
> 1388.5| 239400.3 1623.5| +664549.1 +4506.7|
> 10 100 25 1275| 12245.3| 215672.4 1761.3| 91137.3
> 744.3| 101068.3 825.4| +482580.0 +3940.9|
> 10 100 100 2100| 5973.3| 140923.5 2359.2| 22359.4
> 374.3| 25842.7 432.6| +230186.3 +3853.6|
> 100 1 1 201| 71160.9| 165570.8 232.7| 1209681.7
> 1699.9|+1474622.5 +2072.2| 866177.7 1217.2|
> 100 1 2 302| 47319.1| 157226.6 332.3| 849791.6
> 1795.9| +990606.1 +2093.5| 825137.9 1743.8|
> 100 1 5 605| 22567.3| 136572.5 605.2| 465726.6
> 2063.7| 554461.5 2456.9| +699124.2 +3098.0|
> 100 1 10 1110| 12241.0| 111043.3 907.1| 200570.1
> 1638.5| 233323.9 1906.1| +642948.1 +5252.4|
> 100 1 25 2625| 4464.0| 72398.5 1621.8| 82920.7
> 1857.6| 97895.8 2193.0| +457639.0 +10251.8|
> 100 1 100 10200| 860.1| 24847.9 2889.0| 18152.2
> 2110.5| 18367.4 2135.5| +180327.4 +20966.2|
> 100 2 1 301| 46815.9| 160696.6 343.3| 1260595.5
> 2692.7|+1455222.9 +3108.4| 863145.8 1843.7|
> 100 2 2 402| 35447.5| 150768.2 425.3| 872033.3
> 2460.1|+1006330.9 +2838.9| 827931.8 2335.7|
> 100 2 5 705| 19587.2| 131168.8 669.7| 464567.6
> 2371.8| 545684.9 2785.9| +688526.5 +3515.2|
> 100 2 10 1210| 11037.0| 108582.0 983.8| 215955.9
> 1956.7| 240021.9 2174.7| +638698.9 +5786.9|
> 100 2 25 2725| 4232.9| 71036.1 1678.2| 82735.3
> 1954.6| 98670.5 2331.0| +449662.3 +10623.1|
> 100 2 100 10300| 851.9| 24643.1 2892.6| 17611.6
> 2067.2| 18479.8 2169.2| +175928.2 +20650.4|
> 100 5 1 601| 25265.2| 144441.8 571.7| 1163740.5
> 4606.1|+1436733.4 +5686.6| 843670.5 3339.3|
> 100 5 2 702| 21464.1| 135706.9 632.3| 833619.4
> 3883.8| +945707.9 +4406.0| 787369.9 3668.3|
> 100 5 5 1005| 14347.0| 119614.7 833.7| 428651.5
> 2987.7| 523296.4 3647.4| +682096.7 +4754.3|
> 100 5 10 1510| 9354.5| 99791.9 1066.8| 201244.3
> 2151.3| 235072.9 2512.9| +637732.7 +6817.4|
> 100 5 25 3025| 3786.6| 67911.3 1793.5| 80066.9
> 2114.5| 93937.6 2480.8| +437053.6 +11542.1|
> 100 5 100 10600| 827.4| 24141.8 2917.7| 17014.4
> 2056.3| 19307.6 2333.4| +173173.4 +20929.0|
> 100 10 1 1101| 14297.8| 120438.9 842.4| 1023704.6
> 7159.9|+1165436.1 +8151.1| 810992.0 5672.1|
> 100 10 2 1202| 13069.0| 115188.5 881.4| 707840.9
> 5416.2| +813981.7 +6228.4| 763229.5 5840.0|
> 100 10 5 1505| 10118.7| 102630.8 1014.3| 356061.3
> 3518.9| 387553.8 3830.1| +641697.9 +6341.7|
> 100 10 10 2010| 7321.0| 89036.4 1216.2| 199950.9
> 2731.2| 223099.1 3047.4| +633412.2 +8652.0|
> 100 10 25 3525| 3549.8| 61546.7 1733.8| 79029.9
> 2226.3| 90370.9 2545.8| +429170.4 +12090.0|
> 100 10 100 11100| 748.7| 23472.5 3134.9| 15912.5
> 2125.2| 19193.9 2563.5| +170810.7 +22812.9|
> 100 25 1 2601| 6134.5| 83747.1 1365.2| 1002307.0
> 16338.7|+1048943.8 +17099.0| 773842.2 12614.5|
> 100 25 2 2702| 6022.5| 80812.2 1341.8| 690373.8
> 11463.3| +789307.9 +13106.0| 734616.4 12197.9|
> 100 25 5 3005| 5290.0| 74144.5 1401.6| 347291.3
> 6565.1| 388696.0 7347.8| +590149.9 +11156.0|
> 100 25 10 3510| 4377.8| 67076.1 1532.2| 186616.1
> 4262.8| 217718.5 4973.2| +594861.4 +13588.1|
> 100 25 25 5025| 2417.7| 49032.7 2028.1| 67341.0
> 2785.3| 84457.0 3493.3| +404227.5 +16719.4|
> 100 25 100 12600| 760.2| 20921.5 2752.0| 14262.1
> 1876.0| 18742.6 2465.4| +150987.3 +19860.9|
> 100 100 1 10101| 1540.9| 31347.3 2034.4| 686419.2
> 44547.7| +812736.2 +52745.5| 563080.5 36543.2|
> 100 100 2 10202| 1599.6| 30255.6 1891.4| 512547.8
> 32041.4| 568231.7 35522.4| +573178.2 +35831.7|
> 100 100 5 10505| 1556.1| 30008.5 1928.4| 246167.4
> 15819.0| 295721.0 19003.4| +438022.6 +28147.9|
> 100 100 10 11010| 1473.0| 28154.9 1911.3| 123781.7
> 8403.1| 158667.0 10771.4| +422046.3 +28651.3|
> 100 100 25 12525| 1214.5| 24826.4 2044.1| 57454.1
> 4730.6| 53768.6 4427.1| +285759.8 +23528.5|
> 100 100 100 20100| 562.8| 14887.9 2645.4| 9575.2
> 1701.4| 10747.1 1909.6| +112829.4 +20048.4|
> 1000 1 1 2001| 7569.6| 18967.7 250.6| 1000978.7
> 13223.6|+1080332.6 +14271.9| 771630.1 10193.7|
> 1000 1 2 3002| 4826.5| 17037.4 353.0| 666101.8
> 13800.8| +757023.3 +15684.6| 724266.7 15005.9|
> 1000 1 5 6005| 2336.2| 15062.9 644.8| 303254.6
> 12980.7| 334139.1 14302.7| +538101.4 +23033.2|
> 1000 1 10 11010| 1220.0| 11970.2 981.2| 138316.2
> 11337.5| 148179.3 12145.9| +408164.4 +33456.3|
> 1000 1 25 26025| 443.7| 7623.2 1718.3| 34113.0
> 7689.1| 30913.0 6967.8| +177876.3 +40093.4|
> 1000 1 100 101100| 84.3| 2468.9 2928.5| 2571.5
> 3050.1| 2859.8 3392.1| +13884.3 +16468.7|
> 1000 2 1 3001| 4905.2| 18267.7 372.4| 993230.1
> 20248.7|+1029848.9 +20995.2| 759556.4 15484.8|
> 1000 2 2 4002| 3555.7| 16763.4 471.4| 629670.4
> 17708.6| +690171.9 +19410.1| 676033.7 19012.5|
> 1000 2 5 7005| 1991.1| 14572.6 731.9| 301237.7
> 15129.0| 307670.9 15452.1| +490246.8 +24621.6|
> 1000 2 10 12010| 1108.0| 11563.9 1043.7| 126427.0
> 11410.7| 136701.5 12338.0| +414599.8 +37419.7|
> 1000 2 25 27025| 432.4| 7487.6 1731.8| 33016.2
> 7636.3| 33746.7 7805.3| +179156.7 +41437.1|
> 1000 2 100 102100| 83.4| 2461.1 2950.2| 2452.5
> 2939.8| 2422.0 2903.2| +13665.8 +16381.2|
> 1000 5 1 6001| 2582.6| 16092.1 623.1| 834306.9
> 32304.6| +893998.4 +34615.9| 684801.2 26515.7|
> 1000 5 2 7002| 2190.9| 14064.5 642.0| 566604.2
> 25862.0| 605906.5 27655.9| +622503.9 +28413.5|
> 1000 5 5 10005| 1468.3| 13074.6 890.5| 258037.6
> 17574.3| 308088.0 20983.1| +444225.3 +30255.1|
> 1000 5 10 15010| 929.6| 10634.7 1144.0| 114688.9
> 12337.4| 127073.2 13669.6| +347484.4 +37379.7|
> 1000 5 25 30025| 402.6| 7036.0 1747.5| 29048.0
> 7214.5| 30214.3 7504.2| +162313.3 +40313.1|
> 1000 5 100 105100| 82.3| 2402.8 2919.4| 2360.9
> 2868.4| 2589.4 3146.1| +12952.8 +15737.6|
> 1000 10 1 11001| 1445.0| 13367.3 925.1| +683761.0
> +47318.3| 675209.4 46726.5| 562329.9 38914.9|
> 1000 10 2 12002| 1309.7| 12439.2 949.7| 483623.4
> 36925.1| 468215.2 35748.7| +493636.6 +37689.6|
> 1000 10 5 15005| 1020.7| 11027.6 1080.4| 202199.3
> 19809.6| 213994.4 20965.1| +343494.6 +33652.3|
> 1000 10 10 20010| 709.5| 8101.9 1142.0| 84429.2
> 11900.5| 89562.1 12624.0| +298947.9 +42137.5|
> 1000 10 25 35025| 359.5| 6504.4 1809.3| 23864.3
> 6638.3| 26191.8 7285.7| +148658.8 +41352.0|
> 1000 10 100 110100| 77.4| 2339.1 3023.4| 2384.8
> 3082.5| 2237.6 2892.2| +12432.5 +16069.4|
> 1000 25 1 26001| 623.4| 8975.4 1439.7| +414136.0
> +66428.3| 392230.0 62914.6| 331792.3 53220.2|
> 1000 25 2 27002| 602.3| 8387.7 1392.6| 269179.2
> 44690.8| 273939.6 45481.1| +324980.3 +53955.2|
> 1000 25 5 30005| 532.8| 7839.3 1471.5| 126420.4
> 23729.5| 135093.8 25357.5| +221663.1 +41606.8|
> 1000 25 10 35010| 440.1| 6948.5 1578.8| 63235.6
> 14367.5| 64159.0 14577.4| +202311.2 +45966.5|
> 1000 25 25 50025| 271.1| 5203.6 1919.4| 21312.3
> 7861.3| 21140.1 7797.8| +110040.4 +40589.7|
> 1000 25 100 125100| 75.1| 2111.2 2811.5| 1952.8
> 2600.5| 2060.8 2744.4| +12081.9 +16089.5|
> 1000 100 1 101001| 162.0| 3203.9 1977.3| 116682.2
> 72011.6| +125619.4 +77527.2| 118859.9 73355.6|
> 1000 100 2 102002| 159.8| 3077.3 1925.9| 79104.9
> 49505.6| 85925.3 53773.9| +120926.8 +75678.6|
> 1000 100 5 105005| 156.6| 3012.6 1924.3| 40502.8
> 25871.7| 39483.2 25220.4| +75288.6 +48091.5|
> 1000 100 10 110010| 146.2| 2839.9 1942.2| 22170.3
> 15161.9| 23012.8 15738.1| +70169.8 +47988.0|
> 1000 100 25 125025| 122.0| 2513.4 2059.8| 7832.6
> 6419.0| 8531.2 6991.5| +44494.1 +36463.8|
> 1000 100 100 200100| 55.9| 1501.8 2687.2| 1260.1
> 2254.7| 1274.9 2281.3| +6722.1 +12028.3|
>
> What you can see is that the naive strategy is only the best strategy when
> the string is very short and has few space/non-space sequences. As the
> string length rises the strategies that avoid doing \s+ and instead remove
> a fixed number of whitespace characters from the end of the string are
> actually faster, even if they have a high overhead. You can see that
> effectively the speed of the "loop" strategies are dominated by the number
> of spaces at the right and run independently of the length of the string
> (loop and loop_chop are heavily dependent on the number of spaces on the
> right, loop2 is smarter and reduces that cost significantly). Both the
> naive and separate approaches are run-time proportional to the length of
> the string, for naive the use of an alternation provides terrible
> performance for sequences of space/non-space, and the s/\s+\z// forces the
> "separate" function to be run time proportional to the length as well. What
> all this shows is that a properly implemented trim/trim function in XS
> would be *massively* faster than all of this.It would be able to do a very
> low overhead walk from the right to ensure that the performance is
> completely dominated by the number of spaces it needs to remove which I
> guess would be as efficient it can be made to be.
>
> I note that if you consider rtrimming sentences, most fo the sentences in
> this mail would be of a type and structure that most users would benefit
> from using the loop2 strategy, not the commonly recommended separate
> strategy.
>
> Which just proves the point, most people, even the experts like myself and
> people on this list do not implement rtrim efficiently. In fact, it's quite
> hard to do so.
>
> cheers,
> Yves
>
> --
> perl -Mre=debug -e "/just|another|perl|hacker/"
>
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
I think this is a good take-away from that analysis:

demerphq <demerphq@gmail.com> wrote:

> What all this shows is that a properly implemented trim/trim function in XS would be *massively* faster than all of this.
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
Philip R Brenan<philiprbrenan@gmail.com> wrote:

> I urge that this shows that the Perl ecosystem works well as is - in the highly unlikely that one really needs a faster trim function there are good solutions immediately available on CPAN.

I think you can certainly make the point that the
performance of trim solutions isn't usually a huge
bottleneck, but my take from this discussion is the
opposite of yours: when they need to do a trim even in this day and
age, experienced perl programmers are evidently still
reaching for excessively complex solutions that don't work
all that well. Having a good solution built into core
would be a definite improvement, albeit a small one.
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
Doing benchmarks to find best algorithms can be
addictive, but simple question --

what is likely to be the typical input?

It's fine to consider best in class for thousands
of spaces or line lengths >512 characters, but
what is likely to be the best algorithm
for use on large numbers of short strings?

Like maybe a Gaussian distribution around 15-25 characters,
but with many many strings?
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
On Tue, Jun 01, 2021 at 08:59:03AM +0200, demerphq wrote:

> I put the following together. It benchmarks various techniques for trimming
> strings at different string lengths and composition.

Cool, thanks.

> It produces the following report. The left side shows the composition of
> the string, and its length. The next column is timing for the naive
> s/\A\s+|\s+\z//g approach. The following four columns contain data for each
> other comparison strategy. "separate" is standard recommended "less worse
> way" of using two s/\A\s+// and s/\s+\z//. The rest are solutions I ginned
> up knowing how the regex engine works to optimize the separate strategy.
> The strategy that is the +best+ for any row is prefixed with a + sign.

These are strategies I would never have considered - thanks for the insight.

> "separate" function to be run time proportional to the length as well. What
> all this shows is that a properly implemented trim/trim function in XS
> would be *massively* faster than all of this.It would be able to do a very
> low overhead walk from the right to ensure that the performance is
> completely dominated by the number of spaces it needs to remove which I
> guess would be as efficient it can be made to be.

I came up with this:

while (1) {
const char *was_s = s;
if (s == strpos)
break;
s = (const char *) Perl_utf8_hop_back((const U8 *)s, -1, (const U8 *)strpos);
if (s < strpos || !isSPACE_utf8_safe(s, strend)) {
s = was_s;
break;
}
}

[with 8-bit variants for !isSPACE(*s) and !isSPACE_L1(*s)]

I'm still thinking that there ought to be a more elegant way to express
the two `if`s and the (effective) backtracking of the `s = was_s`, but
I can't see it.

> I note that if you consider rtrimming sentences, most fo the sentences in
> this mail would be of a type and structure that most users would benefit
> from using the loop2 strategy, not the commonly recommended separate
> strategy.

Yes, this is quite an eye-opener. Thanks for making me think.

So I took your ideas and tried to implement them.

More - I assumed that the regexes used to "trim spaces from the right" are

1) simple to recognise
2) there aren't that many variations of them

So I set off with the goal of recognising them in the regex compiler, and
then having re_intuit_start() implement them better.

In the branch https://github.com/nwc10/perl5/tree/intiuit-rtrim

(if I have this right) regcomp.c recognises all patterns of the form

{ PLUS , STAR } { POSIXU[\s] , POSIXD[\d] } { EOS , SEOL } END

ie

/\s+$/
/\s+\z/
/\s+$/u
/\s+\z/u

and with * instead of +
(These days, [[:space:]] is \s, so that's covered too)


and regexec.c matches these efficiently starting from the end of the string.

If I understand this correctly, it isn't totally generalisable to "matching
in reverse", at least not easily (fixed width, or one greedy match) because
in this case

for /\s+$/ both /\s+/ and /$/ are variable width
but because /\s+$/ is effectively /\s+\n?\z/
and \n is part of the class \s
we can eliminate \n?
getting us to /\s+\z/

which is easy to run in reverse, and doesn't backtrack ("forwardtrack"?)


Anyway, I ran your benchmarks against it:

reps ns sp len| naive| separate as pct| loop as pct| loop_chop as pct| loop2 as pct|
-----------------------+----------+---------------------+---------------------+---------------------+---------------------+
1 1 1 3| 1003690.9|+1113130.0 +110.9| 712513.8 71.0| 667763.9 66.5| 652929.7 65.1|
1 1 2 5| 990465.9|+1100682.3 +111.1| 523228.6 52.8| 522814.7 52.8| 628417.3 63.4|
1 1 5 11| 1001701.1|+1102864.4 +110.1| 292535.4 29.2| 321753.0 32.1| 496744.6 49.6|
1 1 10 21| 996332.8|+1026238.2 +103.0| 166753.8 16.7| 188127.1 18.9| 475441.6 47.7|
1 1 25 51| +974412.6| 958821.1 98.4| 70433.3 7.2| 86395.7 8.9| 377091.7 38.7|
1 1 100 201| +874699.0| 833294.3 95.3| 18074.5 2.1| 24223.6 2.8| 188026.0 21.5|
1 2 1 4| 909935.2|+1111119.9 +122.1| 709812.3 78.0| 661379.5 72.7| 658296.4 72.3|
1 2 2 6| 897650.7|+1113217.6 +124.0| 522643.4 58.2| 514531.6 57.3| 586765.1 65.4|
1 2 5 12| 884091.4| +975138.5 +110.3| 289300.7 32.7| 310588.2 35.1| 484564.9 54.8|
1 2 10 22| 920730.7|+1035058.7 +112.4| 165761.6 18.0| 189035.6 20.5| 451677.3 49.1|
1 2 25 52| 904542.0| +963969.9 +106.6| 70634.5 7.8| 86737.0 9.6| 376839.8 41.7|
1 2 100 202| 807114.9| +837355.2 +103.7| 17996.3 2.2| 24203.0 3.0| 183403.3 22.7|
1 5 1 7| 726176.2|+1110739.9 +153.0| 725535.5 99.9| 661087.9 91.0| 602122.1 82.9|
1 5 2 9| 1020523.0|+1186136.1 +116.2| 581570.7 57.0| 565234.1 55.4| 626664.9 61.4|
1 5 5 15| 733285.2|+1042938.0 +142.2| 281291.7 38.4| 305813.7 41.7| 458376.5 62.5|
1 5 10 25| 727141.1|+1028611.2 +141.5| 158939.8 21.9| 188587.4 25.9| 457126.3 62.9|
1 5 25 55| 716586.6| +955610.1 +133.4| 69516.4 9.7| 86701.8 12.1| 348686.2 48.7|
1 5 100 205| 659236.8| +835977.0 +126.8| 17889.2 2.7| 24387.6 3.7| 171207.3 26.0|
1 10 1 12| 539091.4|+1010957.9 +187.5| 656888.1 121.9| 731871.7 135.8| 546357.7 101.3|
1 10 2 14| 542148.2|+1007476.4 +185.8| 484258.5 89.3| 472815.5 87.2| 524782.3 96.8|
1 10 5 20| 546463.8| +994341.3 +182.0| 267874.3 49.0| 306383.1 56.1| 442522.4 81.0|
1 10 10 30| 547041.5| +988872.6 +180.8| 155924.9 28.5| 188634.6 34.5| 405603.0 74.1|
1 10 25 60| 539135.6| +923883.2 +171.4| 69141.8 12.8| 87345.4 16.2| 311757.8 57.8|
1 10 100 210| 504959.9| +808303.4 +160.1| 17538.3 3.5| 24412.1 4.8| 169319.9 33.5|
1 25 1 27| 320310.9| +950596.1 +296.8| 629869.3 196.6| 718389.9 224.3| 478911.2 149.5|
1 25 2 29| 319985.6| +948728.2 +296.5| 469684.4 146.8| 482698.3 150.9| 469070.7 146.6|
1 25 5 35| 322689.0| +892289.0 +276.5| 268205.3 83.1| 313064.8 97.0| 394188.9 122.2|
1 25 10 45| 321842.4| +926002.1 +287.7| 156897.8 48.7| 192949.7 60.0| 396619.0 123.2|
1 25 25 75| 319636.4| +902389.8 +282.3| 69378.8 21.7| 89636.5 28.0| 304142.2 95.2|
1 25 100 225| 306474.1| +718840.8 +234.6| 17521.0 5.7| 24544.0 8.0| 155921.8 50.9|
1 100 1 102| 107562.8| +848547.6 +788.9| 583851.5 542.8| 720868.6 670.2| 448055.9 416.6|
1 100 2 104| 106627.1| +821922.4 +770.8| 438928.5 411.6| 464326.2 435.5| 441638.8 414.2|
1 100 5 110| 106792.6| +836917.0 +783.7| 241029.3 225.7| 304487.1 285.1| 356727.7 334.0|
1 100 10 120| 106981.3| +884446.8 +826.7| 138200.1 129.2| 188117.9 175.8| 380930.9 356.1|
1 100 25 150| 107641.7| +853730.2 +793.1| 60698.1 56.4| 88785.2 82.5| 280484.1 260.6|
1 100 100 300| 106263.3| +723355.2 +680.7| 15877.9 14.9| 24164.9 22.7| 147776.9 139.1|
10 1 1 21| 362072.0| +978057.7 +270.1| 656784.2 181.4| 724028.8 200.0| 492043.7 135.9|
10 1 2 32| 271697.1| +936424.7 +344.7| 471022.5 173.4| 478432.9 176.1| 463777.9 170.7|
10 1 5 65| 155803.0| +929128.2 +596.3| 265646.1 170.5| 309883.3 198.9| 395126.2 253.6|
10 1 10 120| 90090.0| +822515.8 +913.0| 142389.5 158.1| 191897.6 213.0| 364423.5 404.5|
10 1 25 285| 36999.4| +758913.2 +2051.1| 59238.7 160.1| 86843.1 234.7| 262869.5 710.5|
10 1 100 1110| 7777.0| +639082.7 +8217.6| 12826.6 164.9| 22749.6 292.5| 125908.3 1619.0|
10 2 1 31| 268092.2| +950726.5 +354.6| 640084.3 238.8| 727862.7 271.5| 477444.9 178.1|
10 2 2 42| 215882.7| +955483.7 +442.6| 468420.6 217.0| 472943.8 219.1| 463272.4 214.6|
10 2 5 75| 135731.4| +945047.2 +696.3| 265790.9 195.8| 309500.0 228.0| 395545.1 291.4|
10 2 10 130| 83247.8| +835837.0 +1004.0| 135492.4 162.8| 189524.0 227.7| 374883.8 450.3|
10 2 25 295| 35665.3| +764128.4 +2142.5| 59462.3 166.7| 87140.9 244.3| 267510.7 750.1|
10 2 100 1120| 7720.9| +643190.7 +8330.5| 12797.4 165.8| 22832.9 295.7| 125253.2 1622.3|
10 5 1 61| 159995.4| +951719.0 +594.8| 649259.8 405.8| 724267.6 452.7| 477853.0 298.7|
10 5 2 72| 140118.5| +935671.8 +667.8| 466523.7 332.9| 477597.2 340.9| 465664.2 332.3|
10 5 5 105| 101664.6| +837628.7 +823.9| 254422.3 250.3| 306449.2 301.4| 367849.0 361.8|
10 5 10 160| 68558.6| +870336.8 +1269.5| 138109.3 201.4| 183029.0 267.0| 354533.6 517.1|
10 5 25 325| 32743.8| +755782.7 +2308.2| 59038.4 180.3| 85755.4 261.9| 264079.3 806.5|
10 5 100 1150| 7573.7| +631498.9 +8338.1| 12899.4 170.3| 21500.8 283.9| 127344.1 1681.4|
10 10 1 111| 95824.1| +852424.3 +889.6| 587633.9 613.2| 693153.5 723.4| 450226.5 469.8|
10 10 2 122| 88437.3| +846479.1 +957.2| 423208.2 478.5| 464149.7 524.8| 439821.6 497.3|
10 10 5 155| 70747.2| +832122.4 +1176.2| 233055.2 329.4| 291939.9 412.7| 361826.8 511.4|
10 10 10 210| 53432.5| +818168.8 +1531.2| 136359.3 255.2| 184151.4 344.6| 351738.4 658.3|
10 10 25 375| 28822.0| +767121.9 +2661.6| 59533.2 206.6| 86358.9 299.6| 265294.4 920.5|
10 10 100 1200| 7326.2| +645491.8 +8810.7| 12669.8 172.9| 18770.3 256.2| 122905.9 1677.6|
10 25 1 261| 43817.4| +799756.8 +1825.2| 586361.7 1338.2| 673756.8 1537.6| 431884.3 985.6|
10 25 2 272| 42309.0| +805735.5 +1904.4| 408213.8 964.8| 456803.7 1079.7| 431699.1 1020.3|
10 25 5 305| 37789.2| +787450.4 +2083.8| 232726.2 615.9| 287752.3 761.5| 340376.3 900.7|
10 25 10 360| 32019.5| +813384.3 +2540.3| 133512.1 417.0| 181959.1 568.3| 357928.8 1117.8|
10 25 25 525| 21310.9| +782197.0 +3670.4| 58363.9 273.9| 85358.7 400.5| 259165.3 1216.1|
10 25 100 1350| 6725.7| +645953.1 +9604.3| 11936.8 177.5| 17319.4 257.5| 116960.4 1739.0|
10 100 1 1011| 11809.3| +725670.8 +6144.9| 517029.4 4378.2| 615547.0 5212.4| 409429.1 3467.0|
10 100 2 1022| 11721.7| +724232.6 +6178.6| 381165.0 3251.8| 414482.7 3536.0| 396596.8 3383.4|
10 100 5 1055| 11479.2| +700622.2 +6103.4| 193611.6 1686.6| 234019.2 2038.6| 318668.9 2776.1|
10 100 10 1110| 10777.8| +714691.7 +6631.1| 116234.1 1078.5| 142118.5 1318.6| 315594.0 2928.2|
10 100 25 1275| 9217.4| +696545.8 +7556.8| 44512.5 482.9| 65640.8 712.1| 230324.3 2498.8|
10 100 100 2100| 4738.5| +631382.1 +13324.4| 13369.8 282.2| 16669.3 351.8| 125697.7 2652.7|
100 1 1 201| 52580.8| +804582.2 +1530.2| 587934.0 1118.2| 673257.7 1280.4| 438902.8 834.7|
100 1 2 302| 34648.7| +791969.1 +2285.7| 403745.4 1165.3| 444464.7 1282.8| 414596.7 1196.6|
100 1 5 605| 16967.0| +760774.6 +4483.8| 220493.2 1299.5| 288250.8 1698.9| 345578.1 2036.8|
100 1 10 1110| 9048.6| +685376.2 +7574.4| 103803.0 1147.2| 140017.6 1547.4| 314603.0 3476.8|
100 1 25 2625| 3504.3| +646897.0 +18460.0| 47960.3 1368.6| 60669.1 1731.3| 227017.2 6478.2|
100 1 100 10200| 708.7| +417298.7 +58882.0| 10438.8 1472.9| 12858.7 1814.4| 86693.6 12232.7|
100 2 1 301| 34769.9| +819193.4 +2356.0| 561338.7 1614.4| 670608.8 1928.7| 426010.5 1225.2|
100 2 2 402| 25795.4| +766480.7 +2971.4| 394262.1 1528.4| 430261.2 1668.0| 409649.4 1588.1|
100 2 5 705| 14600.9| +759350.9 +5200.7| 236261.9 1618.1| 278647.1 1908.4| 345479.4 2366.1|
100 2 10 1210| 8307.4| +710528.8 +8553.0| 111069.7 1337.0| 144356.0 1737.7| 315260.1 3794.9|
100 2 25 2725| 3410.2| +670630.3 +19665.6| 46884.9 1374.9| 61231.6 1795.6| 228665.4 6705.4|
100 2 100 10300| 709.6| +442275.9 +62324.6| 10506.4 1480.5| 13023.0 1835.2| 86549.6 12196.4|
100 5 1 601| 18807.7| +807868.8 +4295.4| 558586.3 2970.0| 646406.4 3436.9| 425479.6 2262.3|
100 5 2 702| 15877.1| +759312.1 +4782.4| 378857.4 2386.2| 436837.3 2751.4| 404711.7 2549.0|
100 5 5 1005| 10767.5| +736509.4 +6840.1| 188889.0 1754.2| 269362.1 2501.6| 324034.4 3009.4|
100 5 10 1510| 6917.1| +700177.6 +10122.4| 112900.5 1632.2| 138431.5 2001.3| 313162.3 4527.4|
100 5 25 3025| 3141.7| +632229.0 +20123.8| 46539.6 1481.4| 59039.4 1879.2| 213271.5 6788.4|
100 5 100 10600| 696.5| +409337.3 +58767.8| 10282.1 1476.2| 12747.6 1830.1| 85741.0 12309.7|
100 10 1 1101| 10588.7| +681805.6 +6439.0| 467428.8 4414.4| 561019.2 5298.3| 406696.9 3840.9|
100 10 2 1202| 9453.4| +695171.4 +7353.6| 339765.7 3594.1| 384120.6 4063.3| 380892.5 4029.1|
100 10 5 1505| 7418.4| +720197.2 +9708.2| 178909.3 2411.7| 226672.8 3055.5| 311068.3 4193.2|
100 10 10 2010| 5368.8| +683785.8 +12736.3| 105917.3 1972.8| 137442.2 2560.0| 315562.1 5877.7|
100 10 25 3525| 2773.3| +622716.6 +22454.3| 40018.5 1443.0| 58528.3 2110.5| 217359.9 7837.7|
100 10 100 11100| 675.3| +432116.8 +63986.5| 7414.2 1097.9| 12098.1 1791.5| 74683.3 11058.9|
100 25 1 2601| 4582.1| +677481.3 +14785.3| 439848.7 9599.2| 460887.0 10058.3| 390709.0 8526.8|
100 25 2 2702| 4406.2| +681993.9 +15478.2| 306663.4 6959.9| 366190.2 8310.9| 369184.4 8378.8|
100 25 5 3005| 3889.9| +650236.0 +16715.8| 179346.9 4610.5| 215085.3 5529.3| 299620.2 7702.4|
100 25 10 3510| 3238.9| +621716.1 +19195.4| 92084.2 2843.1| 130538.4 4030.4| 279362.8 8625.3|
100 25 25 5025| 2071.4| +610553.4 +29475.9| 43993.9 2123.9| 55823.5 2695.0| 204433.2 9869.5|
100 25 100 12600| 625.7| +335126.6 +53557.3| 6152.9 983.3| 11717.2 1872.6| 88832.3 14196.5|
100 100 1 10101| 1198.4| +443884.9 +37038.9| 315165.2 26298.2| 351914.4 29364.7| 299202.5 24966.2|
100 100 2 10202| 1187.7| +452863.5 +38131.0| 239072.4 20129.9| 285951.3 24077.1| 295275.2 24862.1|
100 100 5 10505| 1139.3| +451448.0 +39624.7| 111783.1 9811.5| 168497.9 14789.5| 213627.5 18750.6|
100 100 10 11010| 1080.8| +379067.5 +35072.0| 63204.9 5847.8| 98344.5 9099.0| 205100.2 18976.2|
100 100 25 12525| 911.2| +384162.6 +42160.7| 34897.8 3829.9| 41778.1 4585.0| 132498.6 14541.3|
100 100 100 20100| 449.1| +309577.1 +68934.3| 6843.7 1523.9| 7575.6 1686.9| 64587.8 14381.9|
1000 1 1 2001| 5513.2| +705964.7 +12805.0| 443004.5 8035.4| 462820.5 8394.8| 396660.9 7194.8|
1000 1 2 3002| 3560.8| +654171.4 +18371.4| 319025.6 8959.3| 366448.2 10291.1| 367123.8 10310.1|
1000 1 5 6005| 1699.0| +584030.2 +34374.8| 142617.4 8394.2| 191861.3 11292.6| 253057.5 14894.5|
1000 1 10 11010| 905.6| +387276.1 +42764.6| 71713.3 7918.9| 92462.6 10210.1| 218586.8 24137.2|
1000 1 25 26025| 351.0| +271720.6 +77410.6| 19063.3 5431.0| 22358.2 6369.7| 92276.5 26288.7|
1000 1 100 101100| 71.1| +26474.8 +37254.9| 1576.1 2217.8| 1812.6 2550.6| 7318.9 10299.0|
1000 2 1 3001| 3644.8| +668146.9 +18331.6| 441852.9 12122.9| 454139.7 12460.0| 383729.9 10528.2|
1000 2 2 4002| 2685.5| +590297.4 +21980.5| 312197.4 11625.1| 340585.6 12682.2| 367954.9 13701.3|
1000 2 5 7005| 1487.1| +570606.4 +38370.5| 151929.6 10216.5| 185249.8 12457.2| 260425.0 17512.3|
1000 2 10 12010| 837.2| +456634.9 +54541.5| 78853.3 9418.4| 93514.5 11169.6| 199510.5 23830.0|
1000 2 25 27025| 337.7| +214186.1 +63432.4| 12115.8 3588.2| 20982.4 6214.0| 75445.4 22343.6|
1000 2 100 102100| 70.3| +25851.8 +36782.3| 1606.9 2286.3| 1503.0 2138.4| 10243.6 14574.8|
1000 5 1 6001| 1912.5| +557706.0 +29160.4| 373165.4 19511.5| 412981.4 21593.3| 345404.0 18059.9|
1000 5 2 7002| 1612.9| +518142.8 +32124.2| 284513.7 17639.5| 310736.9 19265.3| 318466.4 19744.5|
1000 5 5 10005| 1081.7| +458660.6 +42401.7| 117417.4 10854.9| 168434.1 15571.2| 223924.7 20701.1|
1000 5 10 15010| 688.5| +375281.2 +54505.5| 70282.7 10207.8| 82576.0 11993.3| 188673.1 27402.7|
1000 5 25 30025| 313.9| +234482.5 +74710.5| 17677.7 5632.4| 19801.7 6309.2| 76560.9 24393.7|
1000 5 100 105100| 69.3| +25507.5 +36793.8| 1529.8 2206.8| 1752.5 2528.0| 7295.5 10523.5|
1000 10 1 11001| 1073.9| +430805.1 +40115.0| 346739.6 32287.1| 352451.4 32819.0| 279801.8 26054.1|
1000 10 2 12002| 972.3| +452078.7 +46497.0| 212260.8 21831.4| 262182.2 26965.9| 257783.3 26513.4|
1000 10 5 15005| 742.2| +396191.6 +53377.5| 88263.7 11891.4| 136228.7 18353.6| 172361.1 23221.6|
1000 10 10 20010| 539.1| +281071.4 +52133.1| 56946.0 10562.3| 63803.3 11834.2| 144340.1 26772.2|
1000 10 25 35025| 276.1| +141760.4 +51352.1| 15896.0 5758.2| 17414.4 6308.3| 75010.7 27172.3|
1000 10 100 110100| 67.5| +20708.8 +30699.8| 653.3 968.5| 1581.9 2345.1| 6065.9 8992.3|
1000 25 1 26001| 462.2| 198952.0 43047.1| 209163.4 45256.5| +225044.3 +48692.7| 202981.7 43919.0|
1000 25 2 27002| 442.6| +219574.3 +49607.7| 146194.6 33029.3| 147752.4 33381.2| 168403.6 38046.9|
1000 25 5 30005| 390.9| +235828.7 +60335.3| 45236.6 11573.5| 77708.5 19881.3| 92192.3 23586.8|
1000 25 10 35010| 324.6| +203732.6 +62758.7| 37268.2 11480.3| 40106.1 12354.4| 80063.3 24663.0|
1000 25 25 50025| 206.7| +121929.8 +58987.0| 8724.1 4220.5| 13577.7 6568.6| 45925.6 22217.8|
1000 25 100 125100| 62.3| +41670.5 +66912.8| 605.2 971.9| 1266.3 2033.3| 5713.6 9174.6|
1000 100 1 101001| 120.1| 54866.4 45672.6| 51591.1 42946.2| +66803.7 +55609.6| 50671.2 42180.4|
1000 100 2 102002| 119.2| +68063.5 +57113.9| 32374.3 27166.2| 47701.9 40028.0| 49531.2 41563.0|
1000 100 5 105005| 114.9| +51774.6 +45077.7| 19059.4 16594.1| 24496.0 21327.5| 34531.5 30065.0|
1000 100 10 110010| 108.2| +49205.3 +45488.1| 11537.2 10665.6| 13758.5 12719.1| 33275.7 30761.9|
1000 100 25 125025| 91.0| +54968.4 +60374.7| 2499.2 2745.0| 5211.6 5724.2| 15169.9 16661.9|
1000 100 100 200100| 45.0| +31219.7 +69398.6| 709.6 1577.4| 719.2 1598.8| 3145.1 6991.3|


*) For all but 4 lines, "separate" is fastest
*) Sometimes up to 60000% (ie SIX HUNDRED TIMES)

So you were right - "a properly implemented trim/trim function in XS would be
*massively* faster than all of this"


But I like the idea of doing it in the regex engine, so that every existing
piece of code writing s/\s+$// goes faster, without any user code changes.

Nicholas Clark
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
On Thu, Jun 03, 2021 at 07:36:18PM +0000, Nicholas Clark wrote:
> (if I have this right) regcomp.c recognises all patterns of the form
>
> { PLUS , STAR } { POSIXU[\s] , POSIXD[\d] } { EOS , SEOL } END

{ PLUS , STAR } { POSIXU[\s] , POSIXD[\s] } { EOS , SEOL } END

pants!

That one got past the proof-reader.

Nicholas Clark
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
Nicholas Clark <nick@ccl4.org> wrote:
:More - I assumed that the regexes used to "trim spaces from the right" are
:
:1) simple to recognise
:2) there aren't that many variations of them
:
:So I set off with the goal of recognising them in the regex compiler, and
:then having re_intuit_start() implement them better.
:
:In the branch https://github.com/nwc10/perl5/tree/intiuit-rtrim

Cute stuff, I like it.

It would make things better if the 'goto fail' could be moved from
dccb62dc33 to ae13beca73, to save anyone writing long explanations about
why 'return strpos' is wrong and then deleting them again.

The "Oh my" comment in the same commit is probably better in the commit
message. Also not sure why you talk about setting it "for now" to
`strend - strbeg` - in this case, isn't it simply the right answer?
More important is probably a comment in the 'else' branch that every
other case is fixed length.

121,600 new tests in re/rtrim.t seems like too much overkill to me.
On the other hand it would be a good idea to add tests in re/opt.t
to verify the optimization is kicking in when and as it should.
(Sadly we don't get the RXf flags directly there, I think I couldn't
work out how to get to them in re::optimization().)

I'm not sure why you think extending to /\s+\z/a isn't worth it; on the
face of it is a fairly trivial extension, and I imagine people are as
likely to use it for speed reasons as for semantics.

In the commit messages and some comments it sometimes seems like you
write [[:space:]] to imply /u and \s to imply /d, which seems likely
to lead to confusion. I'd be inclined to use \s throughout.

And we probably need a more extensible mechanism for patterns with
special-case handling, that doesn't need an extra bit for each one;
I've been thinking we ought to be a lot freer to add more such
special cases. Feels like we should be able to have one bit for
RXf_SPECIALCASE, and store the specifics somewhere else (possibly
just as a custom regop).

Hugo
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
On Thu, Jun 03, 2021 at 07:36:18PM +0000, Nicholas Clark wrote:

> *) For all but 4 lines, "separate" is fastest
> *) Sometimes up to 60000% (ie SIX HUNDRED TIMES)

And after I went to bed I realised that's not a fair comparison. That's
against $naive=~s/\A\s+|\s+\z//g;

So I rewrite your test script to time against the original regex /\s+\z/
implementation, forcing it to be used by adding //a:

default => sub { $default= $string; $default=~s/\A\s+//a;
$default=~s/\s+\z//a; },
optimised => sub { $optimised= $string; $optimised=~s/\A\s+//;
$optimised=~s/\s+\z//; },


etc

The special-cased optimisation is at least 100% faster, sometimes 50x

reps ns sp len| default| optimised as pct| loop as pct| loop_chop as pct| loop2 as pct|
-----------------------+----------+---------------------+---------------------+---------------------+---------------------+
1 1 1 3| 897434.8|+1057610.8 +117.8| 673641.7 75.1| 682353.0 76.0| 607109.1 67.6|
1 1 2 5| 868965.9|+1034517.3 +119.1| 483976.7 55.7| 503774.6 58.0| 584895.0 67.3|
1 1 5 11| 901560.8|+1033024.4 +114.6| 283364.7 31.4| 311627.8 34.6| 462322.5 51.3|
1 1 10 21| 849139.8| +970295.1 +114.3| 162071.1 19.1| 186349.9 21.9| 448332.1 52.8|

I think that there were only 3 where the other approaches beat it:

100 10 1 1101| 96576.9| 567610.3 587.7| 468825.2 485.4| +571266.6 +591.5| 388806.1 402.6|
1000 100 1 101001| 3291.1| 55748.4 1693.9| 50982.1 1549.1| +65185.9 +1980.7| 51170.8 1554.8|
1000 100 2 102002| 3290.7| 44181.7 1342.6| 33793.5 1027.0| 45068.0 1369.6| +49740.8 +1511.6|

and not massively.

Nicholas Clark
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
On Tue, 1 Jun 2021 at 22:21, Joseph Brenner <doomvox@gmail.com> wrote:

> Philip R Brenan<philiprbrenan@gmail.com> wrote:
>
> > I urge that this shows that the Perl ecosystem works well as is - in
> the highly unlikely that one really needs a faster trim function there are
> good solutions immediately available on CPAN.
>
> I think you can certainly make the point that the
> performance of trim solutions isn't usually a huge
> bottleneck, but my take from this discussion is the
> opposite of yours: when they need to do a trim even in this day and
> age, experienced perl programmers are evidently still
> reaching for excessively complex solutions that don't work
> all that well. Having a good solution built into core
> would be a definite improvement, albeit a small one.
>

Yep, I agree. IMO this is a good example of something that *should* be in
the core. Sorry Philip, but I think the module you mention actually makes
the opposite point you think it does. Specifically, your trim function
doesnt do the same as the things it is compared against. Specifically utf8.
It only deals with single octet ut8 sequenes, eg, whitespace that is in the
0.255 codepoint range. So it illustrates the point, even when smart and
knowledgable people do this they do it differently, and at different levels
of quality.

I have some XS code that does this efficiently and properly using custom
opcode you can get it very very fast. So that would backup your point, but
it requires fairly sophisticated knowledge of XS and coding. Even using
standard XS stratgies on a function like this can cost 10-20% of
efficiency. My implementation uses a packed DFA representation that can go
left to right or right to left in a normalized string. Anyone is welcome to
steal it. I plan to test using other representations for the DFA to see if
they are faster but I havent gotten to it yet.

Latest version is here: https://github.com/demerphq/DFA-Trim. The S columns
show the difference between having a "trim function" which implements the
regexes that are used for this, or using an unrolled version (no subcall
overhead), and the U column shows performance under unicode whitespace.
ftrimmed using a custom opcode, and trimmed uses standard XS. blen is
number of bytes (octets) in the string, clen is the number characters, clen
stays the same when U changes, but blen is larger with utf8.

I also took the liberty to see what Statistics::Regression would say is the
performance formula based on the various metrics involved. :-)

cheers,
Yves

$ perl trim_bench.pl | tee report.txt
blen clen S U reps ns sp| naive/s| trimmed/s as pct nv|
ftrimmed/s as pct nv|
------------------------------+------------+-------------------------+-------------------------+
3 3 0 0 1 1 1| 1749431.3| 7257124.1 414.8|
+10115387.9 +578.2|
3 3 1 0 1 1 1| 1332206.5| 7607549.3 571.0|
+10226008.6 +767.6|
8 3 0 1 1 1 1| 1449271.8| 6821414.6 470.7|
+8692133.6 +599.8|
8 3 1 1 1 1 1| 1150727.2| 7010554.4 609.2|
+8595098.8 +746.9|
11 11 0 0 5 1 1| 925086.9| 7572539.2 818.6|
+9994781.5 +1080.4|
11 11 1 0 5 1 1| 783619.0| 7673419.5 979.2|
+10069800.7 +1285.0|
28 11 0 1 5 1 1| 777662.5| 6912584.4 888.9|
+8683042.8 +1116.6|
28 11 1 1 5 1 1| 692525.5| 6896329.9 995.8|
+8567648.5 +1237.2|
21 21 0 0 10 1 1| 544406.8| 7562675.4 1389.2|
+10202130.9 +1874.0|
21 21 1 0 10 1 1| 512782.6| 7490819.6 1460.8|
+10016907.6 +1953.4|
53 21 0 1 10 1 1| 496601.6| 6955115.6 1400.5|
+8533180.5 +1718.3|
53 21 1 1 10 1 1| 463696.8| 6974439.2 1504.1|
+8547453.0 +1843.3|
101 101 0 0 50 1 1| 141951.7| 6269762.9 4416.8|
+9963103.7 +7018.7|
101 101 1 0 50 1 1| 139169.3| 7414851.4 5327.9|
+10014202.8 +7195.7|
253 101 0 1 50 1 1| 127940.6| 6900672.3 5393.7|
+8393279.9 +6560.3|
253 101 1 1 50 1 1| 126493.3| 6682738.2 5283.1|
+8619460.7 +6814.2|
201 201 0 0 100 1 1| 73544.0| 7386335.8 10043.4|
+9601012.9 +13054.8|
201 201 1 0 100 1 1| 72584.0| 7350344.2 10126.7|
+8842686.1 +12182.7|
503 201 0 1 100 1 1| 67347.6| 6619889.5 9829.4|
+7692166.1 +11421.6|
503 201 1 1 100 1 1| 66593.6| 6409988.1 9625.5|
+7872383.2 +11821.5|
11 11 0 0 1 1 5| 1803406.3| 7021279.0 389.3|
+9360498.9 +519.0|
11 11 1 0 1 1 5| 1341346.0| 7100264.0 529.3|
+9025293.3 +672.9|
32 11 0 1 1 1 5| 1401698.5| 4427011.1 315.8|
+5007706.8 +357.3|
32 11 1 1 1 1 5| 1105162.8| 4398239.1 398.0|
+4774180.0 +432.0|
35 35 0 0 5 1 5| 422249.5| 7171813.1 1698.5|
+9049128.4 +2143.1|
35 35 1 0 5 1 5| 391930.0| 7047685.8 1798.2|
+10026621.7 +2558.3|
100 35 0 1 5 1 5| 348855.6| 4387554.6 1257.7|
+4994368.6 +1431.6|
100 35 1 1 5 1 5| 330682.2| 4358683.9 1318.1|
+4773266.3 +1443.5|
65 65 0 0 10 1 5| 223044.0| 7186375.4 3222.0|
+9214197.6 +4131.1|
65 65 1 0 10 1 5| 214939.2| 7312142.6 3402.0|
+9177655.8 +4269.9|
185 65 0 1 10 1 5| 186680.6| 4383275.7 2348.0|
+4942407.2 +2647.5|
185 65 1 1 10 1 5| 178748.2| 4337513.7 2426.6|
+4879647.1 +2729.9|
305 305 0 0 50 1 5| 46669.5| 6615822.4 14175.9|
+8719199.7 +18682.9|
305 305 1 0 50 1 5| 46442.3| 6683930.3 14391.9|
+8557160.5 +18425.4|
865 305 0 1 50 1 5| 39457.2| 4252608.4 10777.8|
+4749284.2 +12036.5|
865 305 1 1 50 1 5| 38996.1| 3981204.8 10209.2|
+4723045.3 +12111.6|
605 605 0 0 100 1 5| 23575.6| 6741013.1 28593.1|
+8706352.9 +36929.5|
605 605 1 0 100 1 5| 23509.9| 6670020.8 28371.2|
+8743639.2 +37191.4|
1715 605 0 1 100 1 5| 19925.3| 3291876.4 16521.1|
+3693032.8 +18534.4|
1715 605 1 1 100 1 5| 19716.0| 3660173.2 18564.5|
+4023543.4 +20407.5|
21 21 0 0 1 1 10| 1797641.6| 6874948.4 382.4|
+8262022.3 +459.6|
21 21 1 0 1 1 10| 1338062.3| 6946696.4 519.2|
+8561874.4 +639.9|
62 21 0 1 1 1 10| 1284971.9| 2753755.2 214.3|
+2968506.7 +231.0|
62 21 1 1 1 1 10| 1013866.0| 2732808.0 269.5|
+2994790.2 +295.4|
65 65 0 0 5 1 10| 255461.9| 6965350.8 2726.6|
+8687774.5 +3400.8|
65 65 1 0 5 1 10| 244527.0| 6689413.3 2735.7|
+8476358.0 +3466.4|
190 65 0 1 5 1 10| 188387.5| 2731839.9 1450.1|
+2920291.8 +1550.2|
190 65 1 1 5 1 10| 181527.6| 2736207.0 1507.3|
+2908312.5 +1602.1|
120 120 0 0 10 1 10| 126219.9| 6890941.4 5459.5|
+7548863.7 +5980.7|
120 120 1 0 10 1 10| 123011.3| 6945381.1 5646.1|
+8361240.6 +6797.1|
350 120 0 1 10 1 10| 91669.9| 2722934.2 2970.4|
+2859403.5 +3119.2|
350 120 1 1 10 1 10| 89900.9| 2694564.2 2997.3|
+2749631.5 +3058.5|
560 560 0 0 50 1 10| 24753.1| 6292408.1 25420.7|
+7324259.5 +29589.3|
560 560 1 0 50 1 10| 24964.5| 6384485.3 25574.2|
+8087236.3 +32394.9|
1630 560 0 1 50 1 10| 18427.7| 2288657.6 12419.6|
+2490011.3 +13512.3|
1630 560 1 1 50 1 10| 18289.8| 2432068.9 13297.4|
+2587294.5 +14146.1|
1110 1110 0 0 100 1 10| 12541.3| 4847950.3 38656.0|
+5664197.9 +45164.5|
1110 1110 1 0 100 1 10| 12523.6| 4601726.8 36744.5|
+5700031.0 +45514.4|
3230 1110 0 1 100 1 10| 9160.7| 2302290.0 25132.3|
+2437886.0 +26612.5|
3230 1110 1 1 100 1 10| 9139.4| 2285089.9 25002.7|
+2453069.6 +26840.7|
101 101 0 0 1 1 50| 1633697.8| 5105643.2 312.5|
+5950604.6 +364.2|
101 101 1 0 1 1 50| 1245256.6| 4546280.1 365.1|
+6059053.8 +486.6|
302 101 0 1 1 1 50| +688892.4| 653682.6 94.9|
667346.4 96.9|
302 101 1 1 1 1 50| 597053.6| 655647.5 109.8|
+670101.4 +112.2|
305 305 0 0 5 1 50| 49301.9| 5082054.4 10308.0|
+6066575.8 +12305.0|
305 305 1 0 5 1 50| 48557.4| 4694811.5 9668.6|
+5895598.7 +12141.5|
910 305 0 1 5 1 50| 25144.0| 648745.6 2580.1|
+649544.7 +2583.3|
910 305 1 1 5 1 50| 25040.9| 654161.4 2612.4|
+663861.1 +2651.1|
560 560 0 0 10 1 50| 22375.8| 4581233.4 20474.0|
+5921732.3 +26464.9|
560 560 1 0 10 1 50| 22165.5| 4794657.6 21631.2|
+5559403.2 +25081.4|
1670 560 0 1 10 1 50| 11434.5| 634261.6 5546.9|
+643978.9 +5631.9|
1670 560 1 1 10 1 50| 11257.7| 636290.5 5652.0|
+641030.6 +5694.1|
2600 2600 0 0 50 1 50| 4155.7| 3823615.1 92009.2|
+4241823.3 +102072.7|
2600 2600 1 0 50 1 50| 4164.3| 3687964.7 88561.3|
+4085354.0 +98104.0|
7750 2600 0 1 50 1 50| 2139.7| 595386.9 27825.7|
+602233.4 +28145.7|
7750 2600 1 1 50 1 50| 2143.0| 596717.0 27844.8|
+603844.8 +28177.4|
5150 5150 0 0 100 1 50| 2079.1| 3115882.6 149869.5|
+3542093.3 +170369.6|
5150 5150 1 0 100 1 50| 2063.1| 3184776.9 154371.6|
+3433360.2 +166420.9|
15350 5150 0 1 100 1 50| 1062.1| 497997.4 46886.0|
+520833.2 +49036.0|
15350 5150 1 1 100 1 50| 1063.0| 512618.2 48224.3|
+521071.3 +49019.5|
201 201 0 0 1 1 100| 1435976.5| 3611229.8 251.5|
+3987887.2 +277.7|
201 201 1 0 1 1 100| 1112297.9| 3522664.0 316.7|
+3958580.3 +355.9|
602 201 0 1 1 1 100| +436385.1| 345277.2 79.1|
347880.0 79.7|
602 201 1 1 1 1 100| +410389.1| 344604.4 84.0|
348968.7 85.0|
605 605 0 0 5 1 100| 21327.0| 3372856.1 15815.0|
+3812017.8 +17874.1|
605 605 1 0 5 1 100| 20659.1| 3369707.7 16311.0|
+3766072.4 +18229.6|
1810 605 0 1 5 1 100| 8387.7| 333743.9 3979.0|
+336426.1 +4011.0|
1810 605 1 1 5 1 100| 8406.5| 333070.0 3962.0|
+336957.2 +4008.3|
1110 1110 0 0 10 1 100| 9604.3| 3367089.1 35058.3|
+3801674.3 +39583.2|
1110 1110 1 0 10 1 100| 9570.2| 3397260.4 35498.2|
+3826106.7 +39979.2|
3320 1110 0 1 10 1 100| 3786.4| 333005.0 8794.8|
+336493.2 +8886.9|
3320 1110 1 1 10 1 100| 3774.4| 334746.6 8868.9|
+337111.2 +8931.5|
5150 5150 0 0 50 1 100| 1775.1| 2424598.3 136586.1|
+2835319.7 +159723.5|
5150 5150 1 0 50 1 100| 1768.5| 2460788.7 139143.5|
+2837999.9 +160472.7|
15400 5150 0 1 50 1 100| 699.5| 289364.4 41366.4|
+294283.9 +42069.6|
15400 5150 1 1 50 1 100| 702.2| 289510.1 41226.2|
+296204.4 +42179.5|
10200 10200 0 0 100 1 100| 872.4| 1898110.9 217571.1|
+2221794.0 +254673.3|
10200 10200 1 0 100 1 100| 873.6| 2027600.5 232100.3|
+2100023.4 +240390.6|
30500 10200 0 1 100 1 100| 346.7| 255322.7 73648.9|
+256034.1 +73854.1|
30500 10200 1 1 100 1 100| 345.5| 258636.7 74848.5|
+262099.7 +75850.7|
7 7 0 0 1 5 1| 1220197.0| 8377520.6 686.6|
+9676674.1 +793.0|
7 7 1 0 1 5 1| 969376.6| 7509623.3 774.7|
+10105718.2 +1042.5|
16 7 0 1 1 5 1| 1038950.1| 6947465.7 668.7|
+8495917.6 +817.7|
16 7 1 1 1 5 1| 865742.2| 6751815.1 779.9|
+8707540.8 +1005.8|
31 31 0 0 5 5 1| 456207.3| 7541014.5 1653.0|
+10041596.4 +2201.1|
31 31 1 0 5 5 1| 379287.1| 7402214.6 1951.6|
+10288450.2 +2712.6|
68 31 0 1 5 5 1| 365095.9| 7054263.2 1932.2|
+8625306.0 +2362.5|
68 31 1 1 5 5 1| 342013.7| 6807226.5 1990.3|
+8700685.1 +2544.0|
61 61 0 0 10 5 1| 230586.0| 7297541.8 3164.8|
+10274830.1 +4456.0|
61 61 1 0 10 5 1| 220239.0| 7386795.8 3354.0|
+10217805.9 +4639.4|
133 61 0 1 10 5 1| 203561.4| 6800147.8 3340.6|
+8235079.0 +4045.5|
133 61 1 1 10 5 1| 196954.6| 6623697.8 3363.1|
+8202139.9 +4164.5|
301 301 0 0 50 5 1| 51058.9| 6877429.7 13469.6|
+9472291.4 +18551.7|
301 301 1 0 50 5 1| 50493.9| 7244103.8 14346.5|
+9488117.0 +18790.6|
653 301 0 1 50 5 1| 45748.1| 5595020.0 12230.0|
+7892845.9 +17252.8|
653 301 1 1 50 5 1| 45256.7| 5695030.2 12583.8|
+7373140.4 +16291.8|
601 601 0 0 100 5 1| 26155.8| 7003219.6 26775.1|
+9450718.6 +36132.4|
601 601 1 0 100 5 1| 25883.5| 7244734.5 27989.8|
+9545552.8 +36878.9|
1303 601 0 1 100 5 1| 23402.1| 4598012.2 19647.8|
+5583783.8 +23860.2|
1303 601 1 1 100 5 1| 22384.9| 4805513.5 21467.7|
+5431825.3 +24265.6|
15 15 0 0 1 5 5| 1242607.5| 7291932.6 586.8|
+9113538.4 +733.4|
15 15 1 0 1 5 5| 991051.6| 7220140.5 728.5|
+8710759.9 +878.9|
40 15 0 1 1 5 5| 983744.9| 4389151.9 446.2|
+4931720.6 +501.3|
40 15 1 1 1 5 5| 830905.5| 4646808.6 559.2|
+5186991.0 +624.3|
55 55 0 0 5 5 5| 275783.7| 7079915.8 2567.2|
+9306184.6 +3374.5|
55 55 1 0 5 5 5| 261015.9| 7221265.1 2766.6|
+9303924.2 +3564.5|
140 55 0 1 5 5 5| 234108.2| 4147401.5 1771.6|
+4799591.0 +2050.2|
140 55 1 1 5 5 5| 222501.0| 4323139.1 1943.0|
+4662593.8 +2095.5|
105 105 0 0 10 5 5| 143286.5| 6937763.3 4841.9|
+8869037.7 +6189.7|
105 105 1 0 10 5 5| 139007.5| 7032463.7 5059.1|
+9218339.4 +6631.5|
265 105 0 1 10 5 5| 121339.1| 4381291.5 3610.8|
+5000198.1 +4120.8|
265 105 1 1 10 5 5| 115870.6| 4261483.2 3677.8|
+4893652.3 +4223.4|
505 505 0 0 50 5 5| 29644.5| 6828287.5 23033.9|
+8627772.6 +29104.1|
505 505 1 0 50 5 5| 29175.6| 6602705.1 22630.9|
+8445703.7 +28947.8|
1265 505 0 1 50 5 5| 25093.3| 3232733.4 12882.8|
+3698901.7 +14740.6|
1265 505 1 1 50 5 5| 21721.5| 3447804.7 15872.8|
+3708393.2 +17072.4|
1005 1005 0 0 100 5 5| 14937.1| 6446973.0 43160.7|
+7637471.2 +51130.7|
1005 1005 1 0 100 5 5| 14721.2| 6508084.7 44208.9|
+7768290.2 +52769.3|
2515 1005 0 1 100 5 5| 12686.9| 3229068.3 25452.0|
+4258006.6 +33562.3|
2515 1005 1 1 100 5 5| 12611.8| 3474194.3 27547.2|
+3716137.2 +29465.6|
25 25 0 0 1 5 10| 1222863.5| 6651206.3 543.9|
+8462211.6 +692.0|
25 25 1 0 1 5 10| 979097.2| 6754517.8 689.9|
+8389980.6 +856.9|
70 25 0 1 1 5 10| 922259.8| 2742917.0 297.4|
+3001443.0 +325.4|
70 25 1 1 1 5 10| 730622.1| 2713271.0 371.4|
+2987895.6 +409.0|
85 85 0 0 5 5 10| 194198.4| 6731569.4 3466.3|
+8599485.2 +4428.2|
85 85 1 0 5 5 10| 186070.0| 7080285.1 3805.2|
+8498316.9 +4567.3|
230 85 0 1 5 5 10| 148388.7| 2743581.5 1848.9|
+2906571.3 +1958.8|
230 85 1 1 5 5 10| 143592.2| 2721770.9 1895.5|
+2938693.5 +2046.6|
160 160 0 0 10 5 10| 95362.7| 6859387.0 7192.9|
+8436995.2 +8847.3|
160 160 1 0 10 5 10| 93576.7| 6892873.1 7366.0|
+8453131.8 +9033.4|
430 160 0 1 10 5 10| 73164.3| 2669907.3 3649.2|
+2903064.1 +3967.9|
430 160 1 1 10 5 10| 71873.7| 2450208.3 3409.0|
+2953653.4 +4109.5|
760 760 0 0 50 5 10| 19142.4| 6441733.0 33651.7|
+7877947.0 +41154.5|
760 760 1 0 50 5 10| 19094.7| 6358162.3 33298.0|
+8126152.9 +42557.1|
2030 760 0 1 50 5 10| 14640.5| 2203811.5 15052.9|
+2432492.6 +16614.9|
2030 760 1 1 50 5 10| 14554.8| 2409211.8 16552.6|
+2553920.6 +17546.9|
1510 1510 0 0 100 5 10| 9570.8| 4599127.5 48053.8|
+4972571.9 +51955.7|
1510 1510 1 0 100 5 10| 9476.0| 4719171.9 49801.2|
+6275554.2 +66225.6|
4030 1510 0 1 100 5 10| 7311.8| 1999713.8 27349.1|
+2122204.2 +29024.3|
4030 1510 1 1 100 5 10| 7287.3| +2266098.8 +31096.4|
2045348.2 28067.2|
105 105 0 0 1 5 50| 1022402.9| 5058852.4 494.8|
+6099303.8 +596.6|
105 105 1 0 1 5 50| 930441.2| 4964326.2 533.5|
+6018844.4 +646.9|
310 105 0 1 1 5 50| 545061.4| 656541.4 120.5|
+661768.8 +121.4|
310 105 1 1 1 5 50| 503470.2| 654515.7 130.0|
+668171.1 +132.7|
325 325 0 0 5 5 50| 45838.6| 5052136.5 11021.6|
+5863801.8 +12792.3|
325 325 1 0 5 5 50| 45649.4| 5216188.5 11426.6|
+6243940.9 +13678.0|
950 325 0 1 5 5 50| 24319.7| 646134.8 2656.8|
+663876.5 +2729.8|
950 325 1 1 5 5 50| 23953.7| 645099.1 2693.1|
+663748.1 +2771.0|
600 600 0 0 10 5 50| 21148.8| 5059489.7 23923.3|
+5862526.3 +27720.4|
600 600 1 0 10 5 50| 21047.5| 4952105.2 23528.2|
+5646388.6 +26826.9|
1750 600 0 1 10 5 50| 11118.8| 628645.6 5653.9|
+641688.6 +5771.2|
1750 600 1 1 10 5 50| 11081.6| 627355.0 5661.2|
+640861.0 +5783.1|
2800 2800 0 0 50 5 50| 3991.3| 3654498.9 91561.1|
+4234958.1 +106104.1|
2800 2800 1 0 50 5 50| 3925.6| 3599802.6 91701.8|
+4095528.9 +104330.0|
8150 2800 0 1 50 5 50| 2080.8| 532856.2 25608.7|
+600968.7 +28882.1|
8150 2800 1 1 50 5 50| 2079.5| 560234.8 26940.8|
+588013.1 +28276.6|
5550 5550 0 0 100 5 50| 1960.8| 2775547.8 141552.9|
+3665323.8 +186931.5|
5550 5550 1 0 100 5 50| 1963.7| 3034329.5 154518.7|
+3447525.5 +175560.1|
16150 5550 0 1 100 5 50| 1027.1| 493410.6 48039.0|
+507766.1 +49436.7|
16150 5550 1 1 100 5 50| 1006.8| +498566.0 +49519.1|
487219.9 48392.1|
205 205 0 0 1 5 100| 1051328.8| 3526300.5 335.4|
+4166362.8 +396.3|
205 205 1 0 1 5 100| 853681.0| 3539861.7 414.7|
+3882312.3 +454.8|
610 205 0 1 1 5 100| +379879.4| 341617.2 89.9|
343719.3 90.5|
610 205 1 1 1 5 100| +360439.8| 339483.4 94.2|
330540.6 91.7|
625 625 0 0 5 5 100| 20612.5| 3093739.1 15009.0|
+3844234.7 +18650.0|
625 625 1 0 5 5 100| 20606.9| 3380120.3 16402.9|
+3794545.7 +18414.0|
1850 625 0 1 5 5 100| 8311.8| 335888.2 4041.1|
+336777.6 +4051.8|
1850 625 1 1 5 5 100| 8244.5| 333360.1 4043.4|
+335873.7 +4073.9|
1150 1150 0 0 10 5 100| 9308.4| 3397441.0 36498.7|
+3709308.0 +39849.0|
1150 1150 1 0 10 5 100| 9018.9| 3201559.0 35498.4|
+3742824.7 +41499.8|
3400 1150 0 1 10 5 100| 3743.7| 332648.8 8885.7|
+336796.8 +8996.5|
3400 1150 1 1 10 5 100| 3744.1| 330852.1 8836.6|
+336458.8 +8986.4|
5350 5350 0 0 50 5 100| 1724.6| 2401014.3 139224.2|
+2763862.8 +160264.1|
5350 5350 1 0 50 5 100| 1718.8| 2635688.8 153343.5|
+2676102.4 +155694.8|
15800 5350 0 1 50 5 100| 694.3| 290626.1 41856.9|
+294792.9 +42457.1|
15800 5350 1 1 50 5 100| 642.9| +295690.6 +45996.5|
294882.4 45870.7|
10600 10600 0 0 100 5 100| 859.1| 1783973.1 207666.7|
+2093887.1 +243742.8|
10600 10600 1 0 100 5 100| 852.1| +2063781.2 +242198.2|
1988917.3 233412.4|
31300 10600 0 1 100 5 100| 344.8| 257591.5 74712.9|
+257733.5 +74754.1|
31300 10600 1 1 100 5 100| 345.0| 262086.2 75972.3|
+262723.7 +76157.1|
12 12 0 0 1 10 1| 857353.0| 7579285.2 884.0|
+9858451.0 +1149.9|
12 12 1 0 1 10 1| 740143.1| 7710910.5 1041.8|
+10041622.1 +1356.7|
26 12 0 1 1 10 1| 768423.6| 6895476.7 897.4|
+8454614.5 +1100.3|
26 12 1 1 1 10 1| 675756.0| 6604936.8 977.4|
+8740956.7 +1293.5|
56 56 0 0 5 10 1| 253764.8| 7360062.7 2900.3|
+10568271.2 +4164.6|
56 56 1 0 5 10 1| 241691.7| 7695722.6 3184.1|
+10126007.3 +4189.6|
118 56 0 1 5 10 1| 227034.3| 6844093.7 3014.6|
+8625183.3 +3799.1|
118 56 1 1 5 10 1| 196747.8| 6854218.5 3483.8|
+7996182.7 +4064.2|
111 111 0 0 10 10 1| 139861.0| 7653046.8 5471.9|
+9782378.4 +6994.4|
111 111 1 0 10 10 1| 132910.5| 7589945.4 5710.6|
+9894702.1 +7444.6|
233 111 0 1 10 10 1| 121863.6| 6465671.6 5305.7|
+8441393.7 +6926.9|
233 111 1 1 10 10 1| 118773.0| 6697787.7 5639.1|
+9348150.8 +7870.6|
551 551 0 0 50 10 1| 29060.5| 7064646.0 24310.1|
+9134062.8 +31431.2|
551 551 1 0 50 10 1| 28935.6| 7167632.5 24771.0|
+8925300.5 +30845.4|
1153 551 0 1 50 10 1| 26110.7| 4059830.6 15548.5|
+5304329.3 +20314.8|
1153 551 1 1 50 10 1| 26037.7| 4551012.4 17478.6|
+5668578.4 +21770.7|
1101 1101 0 0 100 10 1| 14687.3| 4798100.4 32668.4|
+5856244.2 +39872.9|
1101 1101 1 0 100 10 1| 14527.6| 4935782.9 33975.1|
+5601915.4 +38560.4|
2303 1101 0 1 100 10 1| 13252.5| 3945761.8 29773.8|
+5372645.7 +40540.7|
2303 1101 1 1 100 10 1| 13208.9| 4506928.5 34120.3|
+5183200.9 +39240.1|
20 20 0 0 1 10 5| 878907.2| 7073870.4 804.8|
+9317159.3 +1060.1|
20 20 1 0 1 10 5| 741213.3| 7260445.1 979.5|
+9256437.6 +1248.8|
50 20 0 1 1 10 5| 728058.7| 4543521.5 624.1|
+4944264.6 +679.1|
50 20 1 1 1 10 5| 649536.7| 4441479.6 683.8|
+5178706.1 +797.3|
80 80 0 0 5 10 5| 195201.3| 7254994.2 3716.7|
+8945313.8 +4582.6|
80 80 1 0 5 10 5| 187339.7| 7093442.7 3786.4|
+8385043.8 +4475.9|
190 80 0 1 5 10 5| 168185.8| 4381380.2 2605.1|
+4741112.9 +2819.0|
190 80 1 1 5 10 5| 162898.4| 4332072.4 2659.4|
+4859575.8 +2983.2|
155 155 0 0 10 10 5| 100249.2| 6970839.3 6953.5|
+8716814.8 +8695.1|
155 155 1 0 10 10 5| 98709.2| 6725415.3 6813.4|
+9190801.7 +9311.0|
365 155 0 1 10 10 5| 86886.3| 4212157.0 4847.9|
+4811524.3 +5537.7|
365 155 1 1 10 10 5| 84983.5| 4210904.3 4955.0|
+4807318.5 +5656.8|
755 755 0 0 50 10 5| 20505.8| 6636195.2 32362.6|
+8132722.2 +39660.6|
755 755 1 0 50 10 5| 20503.2| 6744674.1 32895.7|
+8498634.0 +41450.3|
1765 755 0 1 50 10 5| 17576.5| 3195455.5 18180.3|
+3567707.6 +20298.2|
1765 755 1 1 50 10 5| 17809.7| 3241070.3 18198.4|
+3428786.2 +19252.4|
1505 1505 0 0 100 10 5| 10347.8| 4634338.5 44785.6|
+5484077.7 +52997.4|
1505 1505 1 0 100 10 5| 10304.1| 5529093.5 53659.2|
+5633170.1 +54669.3|
3515 1505 0 1 100 10 5| 8907.5| 2776361.8 31168.8|
+3316963.0 +37237.8|
3515 1505 1 1 100 10 5| 8983.7| 3011036.1 33516.7|
+3259709.5 +36284.7|
30 30 0 0 1 10 10| 872829.2| 6862472.5 786.2|
+8387203.9 +960.9|
30 30 1 0 1 10 10| 750499.3| 7214763.3 961.3|
+8466059.0 +1128.1|
80 30 0 1 1 10 10| 706970.1| 2557207.5 361.7|
+3017047.9 +426.8|
80 30 1 1 1 10 10| 618657.0| 2751994.0 444.8|
+3015395.5 +487.4|
110 110 0 0 5 10 10| 149369.8| 6828102.1 4571.3|
+8488681.9 +5683.0|
110 110 1 0 5 10 10| 146168.1| 6917652.7 4732.7|
+8773076.5 +6002.0|
280 110 0 1 5 10 10| 117524.8| 2748037.4 2338.3|
+2941273.0 +2502.7|
280 110 1 1 5 10 10| 116488.9| 2750805.2 2361.4|
+2961417.6 +2542.2|
210 210 0 0 10 10 10| 73786.0| 6841137.1 9271.6|
+8577608.1 +11625.0|
210 210 1 0 10 10 10| 73024.8| 6732015.5 9218.8|
+8253717.7 +11302.6|
530 210 0 1 10 10 10| 59164.5| 2662407.5 4500.0|
+2842997.2 +4805.2|
530 210 1 1 10 10 10| 58499.8| 2680052.6 4581.3|
+2932588.2 +5013.0|
1010 1010 0 0 50 10 10| 14993.4| 6104842.3 40716.8|
+7586067.8 +50596.0|
1010 1010 1 0 50 10 10| 14944.1| 6106176.6 40860.2|
+7733769.5 +51751.4|
2530 1010 0 1 50 10 10| 11874.3| 2264102.0 19067.3|
+2445866.5 +20598.0|
2530 1010 1 1 50 10 10| 11818.5| 2232598.9 18890.7|
+2563139.2 +21687.5|
2010 2010 0 0 100 10 10| 7517.2| 4572693.6 60829.8|
+5425892.7 +72179.7|
2010 2010 1 0 100 10 10| 7472.6| 4043515.6 54111.4|
+6580094.9 +88056.6|
5030 2010 0 1 100 10 10| 5944.0| 1970782.0 33156.0|
+2159192.6 +36325.7|
5030 2010 1 1 100 10 10| 5658.4| 1973665.0 34880.3|
+2146999.1 +37943.6|
110 110 0 0 1 10 50| 834455.4| 5176476.3 620.3|
+6385510.3 +765.2|
110 110 1 0 1 10 50| 717782.3| 5215453.0 726.6|
+6128300.2 +853.8|
320 110 0 1 1 10 50| 464191.3| 659389.9 142.1|
+669372.3 +144.2|
320 110 1 1 1 10 50| 435856.4| 657553.3 150.9|
+666935.2 +153.0|
350 350 0 0 5 10 50| 43437.7| 4418114.9 10171.2|
+6088129.9 +14015.8|
350 350 1 0 5 10 50| 42902.6| 5112714.6 11917.0|
+5939010.0 +13843.0|
1000 350 0 1 5 10 50| 23450.9| 651794.4 2779.4|
+658958.0 +2809.9|
1000 350 1 1 5 10 50| 23349.9| +650164.6 +2784.4|
628164.3 2690.2|
650 650 0 0 10 10 50| 19676.0| 4755976.9 24171.5|
+5807507.9 +29515.8|
650 650 1 0 10 10 50| 19825.4| 4771256.5 24066.4|
+5584010.8 +28165.9|
1850 650 0 1 10 10 50| 10769.9| 626876.9 5820.6|
+642771.1 +5968.2|
1850 650 1 1 10 10 50| 10716.4| 633336.8 5910.0|
+654539.3 +6107.8|
3050 3050 0 0 50 10 50| 3771.5| 3432782.3 91018.0|
+4035311.9 +106993.7|
3050 3050 1 0 50 10 50| 3757.5| 3462492.8 92148.9|
+4134867.5 +110043.1|
8650 3050 0 1 50 10 50| 2019.7| +587213.2 +29073.7|
584153.0 28922.2|
8650 3050 1 1 50 10 50| 2010.7| +591448.8 +29414.9|
576335.4 28663.2|
6050 6050 0 0 100 10 50| 1866.8| 2801281.3 150056.1|
+3079816.9 +164976.4|
6050 6050 1 0 100 10 50| 1864.4| 2691932.9 144387.8|
+3105430.0 +166566.7|
17150 6050 0 1 100 10 50| 1002.4| 475792.2 47465.8|
+476132.0 +47499.7|
17150 6050 1 1 100 10 50| 1001.2| 474728.8 47416.9|
+475128.9 +47456.9|
210 210 0 0 1 10 100| 780659.6| 3544183.5 454.0|
+3931891.6 +503.7|
210 210 1 0 1 10 100| 675045.4| 3523579.4 522.0|
+3855877.1 +571.2|
620 210 0 1 1 10 100| 341894.9| 341321.3 99.8|
+345419.8 +101.0|
620 210 1 1 1 10 100| 323690.3| 343709.0 106.2|
+345432.7 +106.7|
650 650 0 0 5 10 100| 20192.8| 3457567.2 17122.8|
+3891143.3 +19270.0|
650 650 1 0 5 10 100| 19992.8| 3429084.1 17151.6|
+3874711.8 +19380.5|
1900 650 0 1 5 10 100| 8198.2| 336062.7 4099.2|
+337419.3 +4115.8|
1900 650 1 1 5 10 100| 8232.0| 336606.6 4089.0|
+338577.5 +4113.0|
1200 1200 0 0 10 10 100| 9106.3| 3390423.3 37231.7|
+3779517.0 +41504.5|
1200 1200 1 0 10 10 100| 9112.4| 3423098.3 37565.2|
+3743913.0 +41085.8|
3500 1200 0 1 10 10 100| 3692.8| 332001.4 8990.4|
+334063.8 +9046.2|
3500 1200 1 1 10 10 100| 3705.6| 336339.7 9076.5|
+338209.9 +9126.9|
5600 5600 0 0 50 10 100| 1699.0| +2450932.2 +144258.3|
2321560.9 136643.7|
5600 5600 1 0 50 10 100| 1690.5| 2157928.0 127652.3|
+2500556.5 +147920.5|
16300 5600 0 1 50 10 100| 685.2| +290396.6 +42381.9|
286634.2 41832.8|
16300 5600 1 1 50 10 100| 690.2| 290297.1 42057.8|
+290569.2 +42097.3|
11100 11100 0 0 100 10 100| 839.6| 1499605.1 178605.5|
+1775499.4 +211465.0|
11100 11100 1 0 100 10 100| 839.8| 1708328.8 203410.8|
+1934718.8 +230367.1|
32300 11100 0 1 100 10 100| 341.5| 256513.5 75104.9|
+260284.9 +76209.1|
32300 11100 1 1 100 10 100| 340.9| +261779.7 +76781.7|
258467.7 75810.2|
52 52 0 0 1 50 1| 274179.6| 7694129.5 2806.2|
+10307258.9 +3759.3|
52 52 1 0 1 50 1| 260591.5| 7779347.8 2985.3|
+10276490.5 +3943.5|
106 52 0 1 1 50 1| 249956.5| 6766147.7 2706.9|
+8765564.8 +3506.8|
106 52 1 1 1 50 1| 239845.2| 6793983.5 2832.7|
+8450111.6 +3523.2|
256 256 0 0 5 50 1| 62822.1| 7537252.2 11997.8|
+10052774.4 +16002.0|
256 256 1 0 5 50 1| 61910.1| 7629445.9 12323.4|
+9801604.6 +15832.0|
518 256 0 1 5 50 1| 56985.0| 6372832.3 11183.3|
+7704760.8 +13520.7|
518 256 1 1 5 50 1| 56374.4| 6190199.4 10980.5|
+8339052.8 +14792.3|
511 511 0 0 10 50 1| 32399.5| 6800476.3 20989.4|
+8960991.7 +27657.8|
511 511 1 0 10 50 1| 31873.5| 6849593.5 21489.9|
+9305075.9 +29193.8|
1033 511 0 1 10 50 1| 29158.7| 6276076.5 21523.9|
+7381677.1 +25315.5|
1033 511 1 1 10 50 1| 27739.0| 5871008.9 21165.1|
+7471345.1 +26934.4|
2551 2551 0 0 50 50 1| 6542.2| 4906977.4 75004.6|
+5649281.3 +86351.0|
2551 2551 1 0 50 50 1| 6228.5| 5395287.3 86623.1|
+6400344.4 +102759.7|
5153 2551 0 1 50 50 1| 5945.5| 3574200.8 60115.8|
+4068765.7 +68434.0|
5153 2551 1 1 50 50 1| 5958.4| 4096899.3 68757.9|
+4189511.6 +70312.2|
5101 5101 0 0 100 50 1| 3284.1| 3769245.0 114772.7|
+4426168.6 +134775.9|
5101 5101 1 0 100 50 1| 3267.4| 4018898.7 123001.6|
+4713098.0 +144248.2|
10303 5101 0 1 100 50 1| 2993.0| +2697377.3 +90123.9|
2472167.1 82599.2|
10303 5101 1 1 100 50 1| 2986.1| +2891932.6 +96847.8|
2690313.8 90095.8|
60 60 0 0 1 50 5| 272907.3| 7157813.5 2622.8|
+9388246.9 +3440.1|
60 60 1 0 1 50 5| 260120.6| 7030765.3 2702.9|
+9455201.7 +3634.9|
130 60 0 1 1 50 5| 246782.6| 4419255.9 1790.7|
+4988403.8 +2021.4|
130 60 1 1 1 50 5| 236442.2| 4254211.4 1799.3|
+4921531.3 +2081.5|
280 280 0 0 5 50 5| 58575.4| 6498663.7 11094.5|
+8940385.8 +15263.0|
280 280 1 0 5 50 5| 57742.8| 7086580.9 12272.7|
+8728141.2 +15115.6|
590 280 0 1 5 50 5| 52873.8| 4169041.5 7884.9|
+4596639.2 +8693.6|
590 280 1 1 5 50 5| 51971.2| 4284518.0 8244.0|
+5268853.3 +10138.0|
555 555 0 0 10 50 5| 29545.1| 6849996.7 23184.8|
+8191842.6 +27726.5|
555 555 1 0 10 50 5| 29504.0| 6805309.7 23065.7|
+8615917.0 +29202.5|
1165 555 0 1 10 50 5| 26526.5| 3308548.0 12472.6|
+3947891.1 +14882.8|
1165 555 1 1 10 50 5| 26437.0| 3473292.9 13138.0|
+3682829.3 +13930.6|
2755 2755 0 0 50 50 5| 6014.5| 4495940.9 74751.4|
+4836910.0 +80420.5|
2755 2755 1 0 50 50 5| 5984.4| 5094466.0 85128.7|
+5345605.8 +89325.3|
5765 2755 0 1 50 50 5| 5393.1| 2672675.5 49557.5|
+3226956.9 +59835.1|
5765 2755 1 1 50 50 5| 5328.7| 2719894.6 51042.6|
+3074556.5 +57698.3|
5505 5505 0 0 100 50 5| 3019.4| 3487563.1 115504.6|
+4495832.0 +148897.4|
5505 5505 1 0 100 50 5| 3002.5| 3782926.5 125993.0|
+4145092.5 +138055.2|
11515 5505 0 1 100 50 5| 2706.7| 1996993.3 73780.6|
+2045182.0 +75561.0|
11515 5505 1 1 100 50 5| 2709.6| +2014302.5 +74339.0|
1851053.2 68314.2|
70 70 0 0 1 50 10| 275073.9| 6780220.0 2464.9|
+8604739.9 +3128.2|
70 70 1 0 1 50 10| 260111.7| 6826983.1 2624.6|
+8699326.7 +3344.5|
160 70 0 1 1 50 10| 242335.0| 2732726.6 1127.7|
+2987095.3 +1232.6|
160 70 1 1 1 50 10| 231630.5| 2775177.4 1198.1|
+3037771.9 +1311.5|
310 310 0 0 5 50 10| 53485.6| 6447087.7 12053.9|
+8119408.6 +15180.6|
310 310 1 0 5 50 10| 53077.0| 6710882.3 12643.7|
+8260967.4 +15564.1|
680 310 0 1 5 50 10| 46958.2| 2594405.1 5524.9|
+2899305.0 +6174.2|
680 310 1 1 5 50 10| 46334.4| 2566333.7 5538.7|
+2873629.7 +6201.9|
610 610 0 0 10 50 10| 26972.1| 6408078.3 23758.2|
+7604974.3 +28195.7|
610 610 1 0 10 50 10| 26807.3| 6451547.9 24066.4|
+7988619.3 +29800.1|
1330 610 0 1 10 50 10| 23337.2| 2317335.3 9929.8|
+2565684.1 +10994.0|
1330 610 1 1 10 50 10| 23167.6| 2308607.1 9964.8|
+2519341.2 +10874.4|
3010 3010 0 0 50 50 10| 5394.0| 4200074.5 77865.9|
+5252543.5 +97377.9|
3010 3010 1 0 50 50 10| 5411.2| 4785789.9 88442.1|
+5648903.7 +104392.5|
6530 3010 0 1 50 50 10| 4693.2| +2058989.1 +43872.1|
2048847.7 43656.0|
6530 3010 1 1 50 50 10| 4690.2| 1893444.1 40370.3|
+2009474.5 +42844.2|
6010 6010 0 0 100 50 10| 2718.6| 2882514.2 106028.0|
+4067886.0 +149629.8|
6010 6010 1 0 100 50 10| 2698.5| 3373793.0 125024.6|
+3563620.5 +132059.1|
13030 6010 0 1 100 50 10| 2347.1| +1412612.1 +60185.7|
1400421.4 59666.3|
13030 6010 1 1 100 50 10| 2338.2| +1382323.2 +59118.6|
1350200.1 57744.8|
150 150 0 0 1 50 50| 270433.5| 5267954.4 1948.0|
+6080280.4 +2248.3|
150 150 1 0 1 50 50| 256057.6| 5033175.1 1965.6|
+6114288.4 +2387.9|
400 150 0 1 1 50 50| 199067.2| 656443.7 329.8|
+666042.9 +334.6|
400 150 1 1 1 50 50| 200273.8| 657828.2 328.5|
+668305.1 +333.7|
550 550 0 0 5 50 50| 28823.5| 5004203.3 17361.6|
+5780345.1 +20054.3|
550 550 1 0 5 50 50| 28382.8| 5029706.6 17721.0|
+5775270.4 +20347.8|
1400 550 0 1 5 50 50| 17874.0| 633941.5 3546.7|
+644801.6 +3607.5|
1400 550 1 1 5 50 50| 17947.3| 631064.0 3516.2|
+644487.1 +3591.0|
1050 1050 0 0 10 50 50| 13631.7| 4812940.0 35307.0|
+5523978.7 +40523.0|
1050 1050 1 0 10 50 50| 13564.0| 4890099.9 36052.0|
+5568000.7 +41049.7|
2650 1050 0 1 10 50 50| 8419.0| 634612.3 7537.9|
+635658.9 +7550.3|
2650 1050 1 1 10 50 50| 8396.0| 635785.5 7572.5|
+645488.8 +7688.0|
5050 5050 0 0 50 50 50| 2609.2| 3332387.7 127717.3|
+3507560.0 +134430.9|
5050 5050 1 0 50 50 50| 2607.6| 3236145.0 124105.5|
+3708135.5 +142206.3|
12650 5050 0 1 50 50 50| 1602.5| +528576.5 +32983.7|
499603.6 31175.8|
12650 5050 1 1 50 50 50| 1598.4| +533344.3 +33367.2|
522599.5 32695.0|
10050 10050 0 0 100 50 50| 1301.8| 1911140.3 146807.1|
+2542818.3 +195330.3|
10050 10050 1 0 100 50 50| 1294.8| +2706447.3 +209032.0|
2292412.1 177054.1|
25150 10050 0 1 100 50 50| 793.1| 428246.8 53998.7|
+437641.8 +55183.4|
25150 10050 1 1 100 50 50| 787.0| 438684.3 55742.2|
+445183.5 +56568.1|
250 250 0 0 1 50 100| 263922.7| 3557169.4 1347.8|
+4024187.3 +1524.8|
250 250 1 0 1 50 100| 249697.6| 3590531.7 1438.0|
+4011383.3 +1606.5|
700 250 0 1 1 50 100| 176845.4| 336875.0 190.5|
+346030.2 +195.7|
700 250 1 1 1 50 100| 172028.8| 341426.0 198.5|
+346055.6 +201.2|
850 850 0 0 5 50 100| 16344.9| 3395879.0 20776.4|
+3874855.7 +23706.9|
850 850 1 0 5 50 100| 16236.2| 3367612.7 20741.3|
+3791530.9 +23352.3|
2300 850 0 1 5 50 100| 7436.8| 334108.5 4492.6|
+334861.7 +4502.8|
2300 850 1 1 5 50 100| 7403.3| 332540.8 4491.8|
+336172.1 +4540.9|
1600 1600 0 0 10 50 100| 7512.7| 2736269.8 36422.0|
+2972338.7 +39564.3|
1600 1600 1 0 10 50 100| 7475.5| 2706029.9 36198.7|
+3004372.2 +40189.6|
4300 1600 0 1 10 50 100| 3387.1| +331904.1 +9799.2|
331110.9 9775.7|
4300 1600 1 1 10 50 100| 3386.5| 328116.5 9688.9|
+331170.2 +9779.1|
7600 7600 0 0 50 50 100| 1408.0| 2043620.7 145146.3|
+2505136.2 +177925.0|
7600 7600 1 0 50 50 100| 1391.9| 2212794.2 158972.3|
+2470188.2 +177464.1|
20300 7600 0 1 50 50 100| 630.3| +280100.4 +44442.2|
273644.5 43417.9|
20300 7600 1 1 50 50 100| 632.3| 276257.0 43689.5|
+279661.1 +44227.9|
15100 15100 0 0 100 50 100| 695.8| 1397254.5 200798.8|
+1462543.9 +210181.5|
15100 15100 1 0 100 50 100| 701.2| 1235577.0 176217.5|
+1407886.4 +200792.1|
40300 15100 0 1 100 50 100| 313.0| 238118.6 76071.0|
+240219.3 +76742.1|
40300 15100 1 1 100 50 100| 313.1| 231723.1 74010.4|
+231849.8 +74050.9|
102 102 0 0 1 100 1| 149510.8| 7550417.9 5050.1|
+9980221.1 +6675.3|
102 102 1 0 1 100 1| 145317.2| 7602834.2 5231.9|
+9692603.5 +6670.0|
206 102 0 1 1 100 1| 135722.1| 6349589.6 4678.4|
+8685495.7 +6399.5|
206 102 1 1 1 100 1| 133153.0| 6876479.6 5164.3|
+8561346.9 +6429.7|
506 506 0 0 5 100 1| 32288.0| 7294752.2 22592.7|
+9437598.0 +29229.4|
506 506 1 0 5 100 1| 32136.8| 7298934.6 22712.1|
+9574070.4 +29791.6|
1018 506 0 1 5 100 1| 29530.3| 6226791.2 21086.1|
+7651857.6 +25911.9|
1018 506 1 1 5 100 1| 29480.7| 6348113.2 21533.1|
+7040594.1 +23882.1|
1011 1011 0 0 10 100 1| 16445.0| 6801003.8 41356.0|
+8831085.4 +53700.7|
1011 1011 1 0 10 100 1| 16289.3| 6956760.7 42707.5|
+8428842.0 +51744.5|
2033 1011 0 1 10 100 1| 13999.5| 4376576.8 31262.3|
+5057636.6 +36127.1|
2033 1011 1 1 10 100 1| 14913.4| 4364976.5 29268.8|
+5292811.9 +35490.3|
5051 5051 0 0 50 100 1| 3339.4| 3333197.9 99813.7|
+4464978.4 +133705.3|
5051 5051 1 0 50 100 1| 3302.5| 3688645.2 111691.2|
+4279990.7 +129597.0|
10153 5051 0 1 50 100 1| 3024.9| 2493252.9 82425.2|
+2832976.3 +93656.2|
10153 5051 1 1 50 100 1| 3025.2| +2826910.0 +93445.0|
2375660.5 78528.7|
10101 10101 0 0 100 100 1| 1673.6| 2410542.5 144029.7|
+2875639.0 +171819.2|
10101 10101 1 0 100 100 1| 1664.7| 2699104.5 162134.4|
+2704048.2 +162431.3|
20303 10101 0 1 100 100 1| 1520.5| 1252654.3 82385.2|
+1280824.2 +84237.9|
20303 10101 1 1 100 100 1| 1519.0| 1239229.4 81582.3|
+1245101.1 +81968.8|
110 110 0 0 1 100 5| 149756.5| 7279690.7 4861.0|
+8951172.8 +5977.2|
110 110 1 0 1 100 5| 144691.7| 7077769.2 4891.6|
+9192378.8 +6353.1|
230 110 0 1 1 100 5| 136332.5| 4429542.3 3249.1|
+4991653.1 +3661.4|
230 110 1 1 1 100 5| 131922.1| 4341241.8 3290.8|
+4944901.2 +3748.3|
530 530 0 0 5 100 5| 31339.8| 6524506.0 20818.6|
+8750833.8 +27922.5|
530 530 1 0 5 100 5| 31027.7| 6871115.6 22145.1|
+8041697.5 +25917.8|
1090 530 0 1 5 100 5| 28296.4| 3473299.6 12274.7|
+3842345.1 +13578.9|
1090 530 1 1 5 100 5| 28056.8| 3593064.9 12806.4|
+3788193.3 +13501.9|
1055 1055 0 0 10 100 5| 15749.9| 5201617.8 33026.4|
+5811330.7 +36897.7|
1055 1055 1 0 10 100 5| 15700.8| 5058342.6 32217.2|
+5819560.5 +37065.4|
2165 1055 0 1 10 100 5| 14213.0| 3035134.0 21354.6|
+3520451.2 +24769.1|
2165 1055 1 1 10 100 5| 14190.7| 3273789.6 23070.0|
+3496860.7 +24641.9|
5255 5255 0 0 50 100 5| 3197.6| 3461724.2 108261.3|
+4269013.0 +133508.3|
5255 5255 1 0 50 100 5| 3175.7| 4023121.8 126683.1|
+4259530.5 +134127.3|
10765 5255 0 1 50 100 5| 2852.3| 1896556.0 66493.1|
+2033586.9 +71297.4|
10765 5255 1 1 50 100 5| 2872.7| 1853418.7 64517.4|
+2193684.2 +76362.0|
10505 10505 0 0 100 100 5| 1597.3| 2371972.0 148502.7|
+2756871.4 +172600.2|
10505 10505 1 0 100 100 5| 1590.6| 2631100.1 165415.0|
+2825525.6 +177638.4|
21515 10505 0 1 100 100 5| 1439.8| 1063861.7 73891.8|
+1093531.1 +75952.6|
21515 10505 1 1 100 100 5| 1439.9| +1083564.0 +75252.9|
1062846.2 73814.1|
120 120 0 0 1 100 10| 149646.0| 6888600.7 4603.3|
+8508799.4 +5686.0|
120 120 1 0 1 100 10| 145178.1| 6725442.5 4632.5|
+8671854.6 +5973.3|
260 120 0 1 1 100 10| 133974.9| 2719948.7 2030.2|
+2973398.9 +2219.4|
260 120 1 1 1 100 10| 130401.3| 2762225.5 2118.2|
+2982887.4 +2287.5|
560 560 0 0 5 100 10| 29960.1| 6107584.9 20385.8|
+7703072.5 +25711.1|
560 560 1 0 5 100 10| 29695.5| 6190669.0 20847.2|
+7743466.8 +26076.2|
1180 560 0 1 5 100 10| 26535.5| 2244499.6 8458.5|
+2511229.0 +9463.7|
1180 560 1 1 5 100 10| 26311.4| 2382013.3 9053.2|
+2505827.4 +9523.7|
1110 1110 0 0 10 100 10| 14900.4| 4545546.6 30506.1|
+5704879.2 +38286.7|
1110 1110 1 0 10 100 10| 13609.9| 4578231.0 33639.1|
+6903561.7 +50724.7|
2330 1110 0 1 10 100 10| 13275.2| 2133457.2 16071.0|
+2431662.6 +18317.3|
2330 1110 1 1 10 100 10| 13287.4| 2138925.1 16097.4|
+2436101.2 +18333.9|
5510 5510 0 0 50 100 10| 3020.4| 3347876.7 110843.6|
+3849284.2 +127444.5|
5510 5510 1 0 50 100 10| 3007.4| 3293957.2 109529.5|
+3973116.7 +132112.7|
11530 5510 0 1 50 100 10| 2674.2| 1422106.6 53177.9|
+1606381.9 +60068.6|
11530 5510 1 1 50 100 10| 2475.1| 1478204.4 59722.8|
+1579635.1 +63820.8|
11010 11010 0 0 100 100 10| 1509.8| 2538081.5 168112.3|
+2616457.2 +173303.6|
11010 11010 1 0 100 100 10| 1506.2| 1990274.6 132143.1|
+2438014.5 +161870.6|
23030 11010 0 1 100 100 10| 1330.0| 919259.7 69116.8|
+937587.2 +70494.8|
23030 11010 1 1 100 100 10| 1331.7| 914765.2 68691.5|
+942492.0 +70773.6|
200 200 0 0 1 100 50| 148630.9| 5020742.9 3378.0|
+6003885.7 +4039.5|
200 200 1 0 1 100 50| 144022.5| 5121558.2 3556.1|
+5955379.8 +4135.0|
500 200 0 1 1 100 50| 123555.6| 658812.8 533.2|
+668943.7 +541.4|
500 200 1 1 1 100 50| 120460.9| 656385.4 544.9|
+670221.2 +556.4|
800 800 0 0 5 100 50| 20111.5| 4724535.2 23491.7|
+5736644.6 +28524.1|
800 800 1 0 5 100 50| 20112.4| 4997411.4 24847.4|
+5580924.5 +27748.6|
1900 800 0 1 5 100 50| 13930.0| 623825.7 4478.3|
+642486.8 +4612.3|
1900 800 1 1 5 100 50| 13829.8| 629770.2 4553.7|
+640922.4 +4634.3|
1550 1550 0 0 10 100 50| 9703.9| 3586257.3 36956.8|
+4340279.9 +44727.1|
1550 1550 1 0 10 100 50| 9696.4| 4036808.1 41632.0|
+4209335.3 +43411.3|
3650 1550 0 1 10 100 50| 6613.3| 580831.0 8782.8|
+627018.4 +9481.2|
3650 1550 1 1 10 100 50| 6557.5| 616724.2 9404.8|
+630613.3 +9616.6|
7550 7550 0 0 50 100 50| 1884.5| 2662227.0 141267.0|
+2950582.3 +156568.1|
7550 7550 1 0 50 100 50| 1875.5| 2946471.8 157105.3|
+3042703.8 +162236.4|
17650 7550 0 1 50 100 50| 1271.7| 461104.2 36259.7|
+478306.7 +37612.5|
17650 7550 1 1 50 100 50| 1261.7| +474035.2 +37572.4|
464727.8 36834.7|
15050 15050 0 0 100 100 50| 940.9| 1528584.7 162455.7|
+1607278.4 +170819.1|
15050 15050 1 0 100 100 50| 935.6| 1456188.7 155642.3|
+1748704.0 +186907.3|
35150 15050 0 1 100 100 50| 631.7| +399714.6 +63279.5|
380006.1 60159.4|
35150 15050 1 1 100 100 50| 634.4| +400354.5 +63106.0|
391440.8 61701.0|
300 300 0 0 1 100 100| 146532.3| 3581470.1 2444.1|
+3973074.2 +2711.4|
300 300 1 0 1 100 100| 142513.3| 3571141.4 2505.8|
+3978273.9 +2791.5|
800 300 0 1 1 100 100| 112041.1| 342038.0 305.3|
+345394.2 +308.3|
800 300 1 1 1 100 100| 109097.9| 341915.2 313.4|
+345698.1 +316.9|
1100 1100 0 0 5 100 100| 13111.7| 3497260.4 26672.8|
+3774952.8 +28790.7|
1100 1100 1 0 5 100 100| 13114.2| 3463415.6 26409.6|
+3697124.8 +28191.7|
2800 1100 0 1 5 100 100| 6641.4| 333279.4 5018.2|
+335679.9 +5054.4|
2800 1100 1 1 5 100 100| 6525.8| +334843.7 +5131.1|
332625.8 5097.1|
2100 2100 0 0 10 100 100| 6144.0| 2729750.4 44429.5|
+3134305.8 +51014.0|
2100 2100 1 0 10 100 100| 6139.6| 2904472.8 47307.0|
+3058741.4 +49819.7|
5300 2100 0 1 10 100 100| 3039.4| 326058.4 10727.7|
+331931.9 +10921.0|
5300 2100 1 1 10 100 100| 3053.0| 328820.8 10770.3|
+330621.6 +10829.2|
10100 10100 0 0 50 100 100| 1169.8| 2136485.5 182639.3|
+2220946.4 +189859.5|
10100 10100 1 0 50 100 100| 1169.8| 1962512.8 167767.2|
+2214711.0 +189326.6|
25300 10100 0 1 50 100 100| 573.6| 267841.8 46697.3|
+271096.0 +47264.7|
25300 10100 1 1 50 100 100| 573.5| 271740.8 47386.7|
+272051.5 +47440.9|
20100 20100 0 0 100 100 100| 577.1| 1011674.7 175306.6|
+1122953.6 +194589.4|
20100 20100 1 0 100 100 100| 581.6| 1029731.6 177066.1|
+1142063.6 +196382.0|
50300 20100 0 1 100 100 100| 284.9| +226421.6 +79481.3|
219674.8 77113.0|
50300 20100 1 1 100 100 100| 261.6| 225963.9 86374.1|
+227845.2 +87093.3|
****************************************************************
Regression 'naive'
****************************************************************
Name Theta StdErr T-stat
[0='const'] 543192.4536 31290.1561 17.36
[1='segments'] -5963.4512 505.5160 -11.80
[2='ns_len'] -3811.6920 374.4922 -10.18
[3='sp_len'] -2617.1242 377.7437 -6.93
[4='as_sub'] -25396.4614 23886.7719 -1.06
[5='unicode'] -64712.6085 27649.4919 -2.34
[6='blen'] 3.1998 4.1283 0.78
[7='clen'] 31.8385 9.3498 3.41

R^2= 0.338, N= 500, K= 8
****************************************************************
****************************************************************
Regression 'trimmed'
****************************************************************
Name Theta StdErr T-stat
[0='const'] 7512390.2282 122346.4551 61.40
[1='segments'] -16409.5684 1976.5989 -8.30
[2='ns_len'] -9016.8632 1464.2876 -6.16
[3='sp_len'] -40507.1236 1477.0012 -27.43
[4='as_sub'] 52843.4435 93398.7628 0.57
[5='unicode'] -2953333.2660 108111.2319 -27.32
[6='blen'] 93.2788 16.1421 5.78
[7='clen'] -191.3023 36.5583 -5.23

R^2= 0.818, N= 500, K= 8
****************************************************************
****************************************************************
Regression 'ftrimmed'
****************************************************************
Name Theta StdErr T-stat
[0='const'] 9551869.0082 164928.2464 57.92
[1='segments'] -22711.1763 2664.5398 -8.52
[2='ns_len'] -12666.8026 1973.9222 -6.42
[3='sp_len'] -53083.0176 1991.0607 -26.66
[4='as_sub'] 17284.4963 125905.5210 0.14
[5='unicode'] -3951711.3590 145738.5576 -27.12
[6='blen'] 147.0455 21.7602 6.76
[7='clen'] -275.5134 49.2822 -5.59

R^2= 0.808, N= 500, K= 8
****************************************************************

--
perl -Mre=debug -e "/just|another|perl|hacker/"
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
On Fri, 4 Jun 2021 at 03:06, <hv@crypt.org> wrote:

> Nicholas Clark <nick@ccl4.org> wrote:
> :More - I assumed that the regexes used to "trim spaces from the right" are
> :
> :1) simple to recognise
> :2) there aren't that many variations of them
> :
> :So I set off with the goal of recognising them in the regex compiler, and
> :then having re_intuit_start() implement them better.
> :
> :In the branch https://github.com/nwc10/perl5/tree/intiuit-rtrim


Nicholas: Very Interesting. Similar to the stuff i did with split. I like.
But I think i missed support for:

s/\s+\z//
s/\s*\z//
s/[\s+]\z//

etc. FWIW I am not sure how sane this approach is for THIS problem but its
worth seeing how far you can take it, and I definitely think it could work.
:-)

BTW, Hugo: the trie code is totally capable of building a machine that we
could use to match /foo\z/ *from the right*, if we wished to do so.
Constructing a DFA to match from the right is pretty much the same as
constructing a DFA from the left, and the trie code just implements a
non-cyclic DFA.

I generate such a machine in the perl code in
https://github.com/demerphq/DFA-Trim/blob/master/ctrie.pl

That perl code is a baby version of what the trie code does in C in the
regex engine.

Yves
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
On 6/4/21 7:29 AM, demerphq wrote:
>
> s/[\s+]\z//
>

I think you meant [\s]+
and that is optimized into \s+, so the engine never has to worry about this
Re: Benchmarking Pure Perl Trim Functions. [ In reply to ]
On Fri, 4 Jun 2021 at 16:38, Karl Williamson <public@khwilliamson.com>
wrote:

> On 6/4/21 7:29 AM, demerphq wrote:
> >
> > s/[\s+]\z//
> >
>
> I think you meant [\s]+
> and that is optimized into \s+, so the engine never has to worry about this
>

Yes, good catch.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"