4 filesystem performance traps in the standard library
TL;DR:
A common answer that comes up since C++17 is to call file_size( path).
Longer Read:
C++20 added std::map::contains which I dislike because it solves the wrong problem. Linux might be pretty good at keeping an inode cache in the kernel, but it’s still costing a filesystem call and a path resolve. As I sometime write in code reviews: “just do the thing”.
Related Skills:
Systems Programming
💬 0 comments