https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79165
--- Comment #17 from David Malcolm <dmalcolm at gcc dot gnu.org> --- I added some instrumentation (covering all files read by input.c) and did some crude timing: Release build, with bogus linemap: nb_read: 1869916 calls to: location_get_source_line: 37494 calls to: read_data: 10 calls to: get_next_line: 577038786 calls to: read_line_num: 37098 real 1m10.032s user 1m9.293s sys 0m0.507s Release build, with bogus linemap, with -fno-diagnostics-show-caret: nb_read: 0 calls to: location_get_source_line: 0 calls to: read_data: 0 calls to: get_next_line: 0 calls to: read_line_num: 0 real 0m37.035s user 0m36.355s sys 0m0.522s Release build, without bogus linemap: nb_read: 1869916 calls to: location_get_source_line: 37494 calls to: read_data: 10 calls to: get_next_line: 5773019 calls to: read_line_num: 37098 real 0m39.018s user 0m38.321s sys 0m0.532s Release build, without bogus linemap, with -fno-diagnostics-show-caret: nb_read: 0 calls to: location_get_source_line: 0 calls to: read_data: 0 calls to: get_next_line: 0 calls to: read_line_num: 0 real 0m38.295s user 0m37.652s sys 0m0.498s Note how with the bogus linemap, without -fno-diagnostics-show-caret, the # of calls to get_next_line increases from 5.7 * 10^6 to 5.7 * 10^8, a 100x increase.