When reading a file on disk, we expect to fail if the file is not found. We can safely skip creating the parent directories in this case since we won't create the file anyway (this requires a write access).
This create_directories call involves 2 syscalls (on Linux) per call and is about 30% of the time spent in the FlatFile::Open() method. This diff is an easy optimization that can boost the access requiring lots of reads, like the listunspent RPC or the various chronik history endpoints.
Details
Details
- Reviewers
PiRK - Group Reviewers
Restricted Project - Commits
- rABC084211792b8b: Skip creating parent directories when accessing a file in read-only mode from…
With Chronik:
ninja all check-all
Diff Detail
Diff Detail
- Repository
- rABC Bitcoin ABC
- Branch
- skip_create_directories_if_ro
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 33674 Build 66827: Build Diff build-clang-tidy · lint-circular-dependencies · build-without-wallet · build-debug · build-clang · build-diff Build 66826: arc lint + arc unit