Bug 247386

Summary: Cwd::cwd() use in File::Spec::Unix use causes unnecessary fork()
Product: [Fedora] Fedora Reporter: Steven Pritchard <steve>
Component: perlAssignee: Robin Norwood <robin.norwood>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: rc040203, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 5.8.8-22.fc8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-07-25 00:53:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
fix cwd() use in File::Spec::Unix none

Description Steven Pritchard 2007-07-08 17:46:27 UTC
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 17:46:27 UTC
Created attachment 158734 [details]
fix cwd() use in File::Spec::Unix

Comment 2 Robin Norwood 2007-07-25 00:53:09 UTC
Patch applied to perl-5.8.8-22.fc8