in reply to Performant Path Iteration

Mmh, with find you have -type f but with PIR you don't have $rule->file set as far as i can see in a hurry. Just an idea. Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^2: Performant Path Iteration
by learnedbyerror (Monk) on Apr 23, 2019 at 04:18 UTC

    Karl, good catch. Given the statistics of the corpus that I use (~ 350 directories compare to ~ 65,000 files), I didn't expect much difference, but I did get a surprise. Adding $rule->file made PIR (both iter and iter_fast) much slower than the alternatives! (FYI, this is using the Benchmark::Forking version of the program).

                      Rate  PIR PIR fast File::Find perl readdir find pipe iter find pipe
    PIR            0.622/s   --     -36%       -67%         -77%           -88%      -89%
    PIR fast       0.975/s  57%       --       -48%         -64%           -82%      -83%
    File::Find      1.89/s 205%      94%         --         -31%           -64%      -67%
    perl readdir    2.74/s 342%     181%        45%           --           -48%      -53%
    find pipe iter  5.32/s 757%     446%       181%          94%             --       -8%
    find pipe       5.80/s 833%     495%       206%         111%             9%        --
    

    Cheers, lbe

      "...much slower than the alternatives..."

      I'm sorry to hear this. Too bad. By instinct i expected the contrary. As salva wrote: "...the bottleneck is going to be the disk I/O...maybe the order used to traverse the file system ...could have some influence." Best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help