https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97834
Bug ID: 97834 Summary: gcov-instrumented binaries are very slow due to unbuffered IO Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: roland.illig at gmx dot de CC: marxin at gcc dot gnu.org Target Milestone: --- Since 2003-05-14, gcov_open calls setbuf (gcov_var.file, (char *)0), thereby slowing down the instrumentation a lot. https://github.com/gcc-mirror/gcc/commit/7d63a2fae019a83772ebae65689f4113a0eb4bec For example, running the 343 unit tests in NetBSD/src/usr.bin/make takes about 14 minutes when running in unbuffered mode, and 30 seconds in buffered mode. The commit itself does not mention why the unbuffered IO is needed. I manually patched the instrumented binary by commenting out the call to setbuf, and the results are still the same. Please consider removing that call to setbuf.