Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The future log format will be using rapidhash instead of murmurhash in order to calculate the hash of the build command. In order not to break in the future we add support now for when the next version of ninja is released.
Unfortunately this means that we need to save the whole build command when parsing instead of generating the hash and discarding the string. This is because we can only locate the
.ninja_log
file once we parse the entire ninja build file to look for anybuilddir
variables. Then only once we have the directory can we attempt to load the.ninja_log
file to figure out which hash function it uses.However, after this change we now get a small performance benefit when there is no
.ninja_log
file or when it contains entries that don't now exist in the ninja build file because we only hash the current build command if necessary.In order to try and reduce some of the extra work we do, this commit also changes the
LogReader
constructor to pass a bitfield on what fields we want to read. In our case this saves us having to decipher the start, end, and modification times of each entry, which we don't need. There are a lot of conditionals here, but they should be predicted by the branch predictor and so changing them to a template paramater isn't needed right now.