Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove assertion that String.UTF8View doesn't underestimate count #392

Merged
merged 1 commit into from
May 6, 2018

Conversation

weissi
Copy link
Member

@weissi weissi commented May 6, 2018

Motivation:

I left an assertion that String.UTF8View's underestimatedCount is equal
to the actual count of UTF-8 code units. It's good to see that it never
failed so far so we can expect it to be really good which is important
for performance.
However, there's no problem if it does actually underestimate maybe for
some special kind of Strings. So the assertion really isn't meaningful.

Modifications:

Remove the assertion.

Result:

Most likely nothing but we will not crash on something that we
shouldn't crash on.

Motivation:

I left an assertion that String.UTF8View's underestimatedCount is equal
to the actual count of UTF-8 code units. It's good to see that it never
failed so far so we can expect it to be really good which is important
for performance.
However, there's no problem if it does actually underestimate maybe for
some special kind of Strings. So the assertion really isn't meaningful.

Modifications:

Remove the assertion.

Result:

Most likely nothing but we will not crash on something that we
shouldn't crash on.
@weissi weissi requested review from normanmaurer and Lukasa May 6, 2018 08:52
@normanmaurer normanmaurer merged commit 12cae95 into apple:master May 6, 2018
@normanmaurer normanmaurer added this to the 1.7.0 milestone May 6, 2018
@weissi weissi deleted the jw-take-out-assert branch May 7, 2018 17:53
@Lukasa Lukasa added the semver/patch No public API change. label May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants