Bug 185882

Summary: [POSIX] Use access() instead of stat() in FileSystem::fileExists()
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: PlatformAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ggaren, mitz, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Benchmark
none
Patch
none
Patch none

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!