Replace assert
by precondition
in most places
#1427
Merged
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 replaces
assert
statements byprecondition
statements in most cases. Afterwards I did a few performance measurements and reverted a fewprecondition
s that had significant performance impact back toassert
statements.As it stands now, this regresses performance of parsing MovieSwiftUI by 2.9% (measured in number of instructions executed).
The biggest (>0.1%) performance regressions are coming from the following files. I’m open to debate if any of the preconditions in there should be changed to
assert
to improve performance but they all seem to provide good value at a reasonable cost to meI am also attaching the numbers spreadsheet that contains all performance measurements: Precondition performance measurements.zip
rdar://106874489