Bug 247386 - Cwd::cwd() use in File::Spec::Unix use causes unnecessary fork()
Cwd::cwd() use in File::Spec::Unix use causes unnecessary fork()
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: perl (Show other bugs)
rawhide
All Linux
high Severity high
: ---
: ---
Assigned To: Robin Norwood
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-08 13:46 EDT by Steven Pritchard
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version: 5.8.8-22.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-07-24 20:53:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
fix cwd() use in File::Spec::Unix (280 bytes, patch)
2007-07-08 13:46 EDT, Steven Pritchard
no flags Details | Diff

  None (edit)
Description Steven Pritchard 2007-07-08 13:46:27 EDT
File::Spec::Unix contains the following code:

sub _cwd {
    require Cwd;
    Cwd::cwd();
}

Cwd::cwd() runs /bin/pwd, slowing down any code that uses IO::File or FileHandle
significantly.  Benchmark illustrates the problem nicely:

Benchmark: timing 100000 iterations of cwd(), getcwd()...
     cwd(): 153 wallclock secs (11.84 usr 32.21 sys + 23.47 cusr 97.53 csys =
165.05 CPU) @ 2270.15/s (n=100000)
  getcwd():  1 wallclock secs ( 0.65 usr +  0.83 sys =  1.48 CPU) @ 67567.57/s
(n=100000)

            Rate    cwd() getcwd()
cwd()     2202/s       --     -97%
getcwd() 68027/s    2989%       --

This has been reported upstream in RT ticket #43633:
http://rt.perl.org/rt3/Public/Bug/Display.html?id=43633
Comment 1 Steven Pritchard 2007-07-08 13:46:27 EDT
Created attachment 158734 [details]
fix cwd() use in File::Spec::Unix
Comment 2 Robin Norwood 2007-07-24 20:53:09 EDT
Patch applied to perl-5.8.8-22.fc8

Note You need to log in before you can comment on or make changes to this bug.