Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Path-Class-Rule CPAN distribution.

Report information
The Basics
Id: 82854
Status: resolved
Priority: 0/
Queue: Path-Class-Rule

People
Owner: Nobody in particular
Requestors: blue [...] thisisnotmyrealemail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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?
Subject: Re: [rt.cpan.org #82854] Massive performance hit
Date: Mon, 21 Jan 2013 10:40:30 -0500
To: bug-Path-Class-Rule [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
Show quoted text
> 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?
I don't think so. I can replicate it. Removing the duplicates gives the same list with both programs. Path::Class::Rule uses Path::Class which uses File::Spec for all operations. File::Find::Rule wraps File::Find, which doesn't really use File::Spec for much and mostly just jams paths together with '/'. So for a big find, P::C::R is paying a big indirection tax. NYTProf says most of the time is spent in File::Spec::Unix and Path::Class::Dir::stringify(). I'm not sure if there's an easy way to optimize it. But I should probably document the performance difference if it can't be. -- David Golden <dagolden@cpan.org> Take back your inbox! → http://www.bunchmail.com/ Twitter/IRC: @xdg
Subject: Re: [rt.cpan.org #82854] Massive performance hit
Date: Mon, 21 Jan 2013 14:12:28 -0500
To: bug-Path-Class-Rule [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
I've filed an optimization ticket on Path::Class here https://github.com/kenahoo/Path-Class/pull/15 That plus a patch I'm about to release for Path::Class::Rule combine for a nearly 80% reduction in run time. That's still roughly half the speed of File::Find::Rule, but I think that's about all that can be reasonably done given the abstraction layers involved. David
Not much more to be done. See Path::Iterator::Rule for same API but faster (without Path::Class).