Bug 185882 - [POSIX] Use access() instead of stat() in FileSystem::fileExists()
Summary: [POSIX] Use access() instead of stat() in FileSystem::fileExists()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-05-22 13:52 PDT by Chris Dumez
Modified: 2018-05-22 17:12 PDT (History)
5 users (show)

See Also:


Attachments
Benchmark (1.76 KB, text/x-csrc)
2018-05-22 13:52 PDT, Chris Dumez
no flags Details
Patch (1.79 KB, patch)
2018-05-22 13:54 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (1.80 KB, patch)
2018-05-22 14:06 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2018-05-22 13:52:09 PDT
Created attachment 341015 [details]
Benchmark

Use access() instead of stat() in FileSystem::fileExists(). stat() returns a lot of information we do not leverage. Local benchmarking on macOS shows access() being > 80% faster than stat().

Benchmark results:
stat: 0.31567 (lower is better)
access: 0.16074 (lower is better)
stat: 0.303665 (lower is better)
access: 0.165468 (lower is better)
Comment 1 Chris Dumez 2018-05-22 13:54:55 PDT
Created attachment 341017 [details]
Patch
Comment 2 Chris Dumez 2018-05-22 14:06:57 PDT
Created attachment 341020 [details]
Patch
Comment 3 Chris Dumez 2018-05-22 14:35:34 PDT
Benchmark results on another macOS machine (Mac Pro instead of MacBook Pro):
stat: 0.345526 (lower is better)
access: 0.20872 (lower is better)
stat: 0.34333 (lower is better)
access: 0.208695 (lower is better)
Comment 4 Geoffrey Garen 2018-05-22 16:26:18 PDT
Comment on attachment 341020 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2018-05-22 16:54:09 PDT
Comment on attachment 341020 [details]
Patch

Clearing flags on attachment: 341020

Committed r232088: <https://trac.webkit.org/changeset/232088>
Comment 6 WebKit Commit Bot 2018-05-22 16:54:11 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-05-22 16:55:23 PDT
<rdar://problem/40469850>
Comment 8 mitz 2018-05-22 17:12:46 PDT
Neat!