Bug 247386 - Cwd::cwd() use in File::Spec::Unix use causes unnecessary fork()
Summary: Cwd::cwd() use in File::Spec::Unix use causes unnecessary fork()
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: perl   
(Show other bugs)
Version: rawhide
Hardware: All Linux
high
high
Target Milestone: ---
Assignee: Robin Norwood
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-07-08 17:46 UTC by Steven Pritchard
Modified: 2007-11-30 22:12 UTC (History)
2 users (show)

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: ---


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

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


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