Subject: | Massive performance hit |
The doc says there is a some overhead with loop_safe, so I tested
without and got similar results. I tried converting this example from
the perlfaq:
http://perldoc.perl.org/perlfaq3.html#How-do-I-find-which-modules-are-installed-on-my-system?
use File::Find::Rule;
my @files = File::Find::Rule->extras({follow =>
1})->name('*.pm')->file()
->in(@INC);
This runs in half a second and produces 3158 items, some of them duplicates.
Converting to Path::Class::Rule:
use Path::Class::Rule;
my $rule = Path::Class::Rule->new->name('*.pm')->file;
# Save the filename, not the Path::Class::File object.
my @files = map { "$_"} $rule->all(@INC, { loop_safe => 0});
This takes 10 seconds to run and produces only 2752, none of them
duplicates. It also uses 100% CPU during that time.
Am I doing something wrong?