summaryrefslogtreecommitdiffstats
path: root/COPYING
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-10-19 23:16:21 (GMT)
committerDan Willemsen <dwillemsen@google.com>2016-11-07 21:57:33 (GMT)
commitc9b5eaa55231612aeff85385033a792949162228 (patch)
treee3c75588da8febd55d106daffae8ab00f7babbda /COPYING
parent04f4bc5dbbc9bfb96ef75f577e919082c8690ae9 (diff)
downloadNinja-c9b5eaa55231612aeff85385033a792949162228.zip
Ninja-c9b5eaa55231612aeff85385033a792949162228.tar.gz
Ninja-c9b5eaa55231612aeff85385033a792949162228.tar.bz2
Optimize ReadFile allocations
Instead of continuously reallocating the output string, call reserve() up front to enlarge the string's buffer. Also use feof() instead of an empty read to detect the end of the file. This saves a syscall on <64kb files, which is about 5% (200ns) of the time to read a file on my machine. For our larger build.ninja files (~550MB), this saves about 500ms, which is more than half the time spent in this function. (Measured by adding METRICS_RECORD to this function during manifest_parser_perftest) For the standard manifest_parser_perftest, this only saves ~20ms out of ~600ms for a full run.
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions