Measuring the Overhead of iostreams: What Is the Difference?
summary
A simple harness generates 1–2 million lines (10–40 million integers) and runs gcc 9.2 -O2 binaries on Ubuntu to compare C stdio vs C++ iostreams with variations: sync_with_stdio(false), untie(cin), and endl vs '\n'. Default iostreams run about 8–11× slower than stdio on files and pipes; disabling sync and untie drops the gap to roughly 1.5–2× and in one config even yields a 10–20% win. The expected big penalty from using endl mostly does not appear except in the fully optimized case.
AI-written summary · about
chapters (6)
- 0:00Start
- 0:57Programming Competitions
- 3:14How Does the Ranking Work?
- 4:40Algorithmic Complexity
- 8:30Concrete Complexity
- 10:16Test Setup
related talks
01h 30mTuning C++: Benchmarks, and CPUs, and Compilers! Oh My!
01h 25mComparing 'Classic C++' and 'Modern C++' Ways to Solve Programming Tasks
01h 06m“Improving Performance Through Compiler Switches..."
45mPerformance Benchmarking with Celero
57mThis Videogame Programmer Used the STL and You Will Never Guess What Happened Next
50mPlenary: C++ MythBusters
59mSoftware Engineering Is About Tradeoffs
57mC++ MythBusters Strike 2
