Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8519] Linux standardizingPath syscall performance #51039

Closed
keith opened this issue Aug 11, 2018 · 2 comments
Closed

[SR-8519] Linux standardizingPath syscall performance #51039

keith opened this issue Aug 11, 2018 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@keith
Copy link
Collaborator

keith commented Aug 11, 2018

Previous ID SR-8519
Radar None
Original Reporter @keith
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 2c4295836ad4a7d07ca26d25e1a3c884

Issue Description:

Currently if you call NSString's `standardizingPath`, you end up calling FileManager's `attributesOfItem` API. This call calls some system API, specifically `getpwuid` and `getgrgid`. These can take a huge amount of time to complete, and the result of them isn't needed in this case, since the only thing we need to know is if the path is a symlink.

In this case it would much faster to directly call lstat, or a different version of `attributesOfItem` that didn't fetch these unused attributes.

In our case, removing this from an IO heavy CLI took run time for some operations from 18 minutes to 4 seconds.

Attached is a flame graph captured using perf with an example (it can be viewed in Safari).

@spevans
Copy link
Collaborator

spevans commented Aug 15, 2018

apple/swift-corelibs-foundation#1662 should hopefully improve things.

@spevans
Copy link
Collaborator

spevans commented Aug 25, 2018

This has been merged into master now.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

2 participants