4 filesystem performance traps in the standard library

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”.
Read the full story at Mropert →
Related Skills: Systems Programming
Wider Reading: roadmap.sh — Systems ProgrammingOSTEP (Operating Systems) — Systems ProgrammingedX — Systems Programming

💬 0 comments

No comments yet — be the first to say what you think.