[4/4] Stop persisting current_loc (+2% parse throughput) - #919
Merged
Merged
Conversation
jkeiser
force-pushed
the
jkeiser/move-current-loc
branch
2 times, most recently
from
June 8, 2020 01:04
1473439 to
caf3879
Compare
jkeiser
force-pushed
the
jkeiser/move-current-loc
branch
from
June 8, 2020 01:44
caf3879 to
e701896
Compare
jkeiser
force-pushed
the
jkeiser/move-current-loc
branch
from
June 8, 2020 03:49
e701896 to
ba7aa09
Compare
jkeiser
force-pushed
the
jkeiser/remove-iterator-variables
branch
from
June 8, 2020 22:22
7dfc8eb to
d178e08
Compare
jkeiser
force-pushed
the
jkeiser/move-current-loc
branch
from
June 8, 2020 22:23
ba7aa09 to
755f2a4
Compare
lemire
reviewed
Jun 11, 2020
Member
|
@jkeiser Let us discuss the unlikely inside an unlikely issue. (Otherwise, this looks good to me.) |
jkeiser
force-pushed
the
jkeiser/move-current-loc
branch
from
June 12, 2020 16:18
755f2a4 to
bbd61eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This change makes it more likely the compiler will enregister the next tape write location (a very hot variable) by making it temporary to stage 2 (i.e. in structural_parser) instead of persisting it in dom_parser_implementation.
This is the last of a series of 4 PRs which simplifies a lot of stage 2 and results in a performance improvement at the end.
Performance
It looks like an overall average throughput improvement close to 2%. The improvements in instruction count and throughput are both pretty much universal. canada.json loses 6% or so overall, but other number parsing things gain substantially. Looking at the numbers, everything has a slightly larger number of cache references, and canada.json is large enough that almost all of them are cache misses, accounting for the difference. The increased number of cache references absolutely does not accord with my theory of why the patch is faster. I'll experiment with that, but I consider this loss acceptable (and recoverable as we delve into streaming in earnest).
PR Notes:
dom_parser_implementation &parsertostructural_parser &parser, because number_writer gets passed to parse_large_integer and slow_parse_float, and that would deenregister the whole thing.uint64_t *and had number_writer store that. That single pointer is enough to write values to the right place and update the pointer.next_tape_locby reference or pointer caused it to de-enregister (reasonably enough). So I pass it by value, let it write the number out, and then bump next_tape_loc after calling either slow_parse_float or parse_large_integer.