develooper Front page | perl.perl5.porters | Postings from June 2021

Re: Benchmarking Pure Perl Trim Functions.

Thread Previous | Thread Next
From:
Philip R Brenan
Date:
June 1, 2021 13:26
Subject:
Re: Benchmarking Pure Perl Trim Functions.
Message ID:
CALhwFRkk-2x=n_hFF8wJWZdOhmk7aJnEJUz1zDwBpaHUv5doVg@mail.gmail.com
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

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About