Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Improve ThrowHelper #7048

Merged
merged 1 commit into from
Sep 5, 2016
Merged

Improve ThrowHelper #7048

merged 1 commit into from
Sep 5, 2016

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Sep 4, 2016

  • ThrowArgumentOutOfRangeException inlined too much so changed to throw directly which stops it being inlined (and its inner Enums)
  • Renamed to ThrowArgumentOutOfRange_IndexException so its clear what is out of range when called.
  • Aggressively inline IfNullAndNullsAreIllegalThenThrow as is above inline size; so its either entirely dropped for reference types; or reduced to the single non-inlined call for boxed value types.
  • Use Enum.ToString for look up as it is fast rather than the manual switch statement translation of the enum to a manual string of the same which is more error prone.

@jkotas
Copy link
Member

jkotas commented Sep 5, 2016

LGTM. Thanks!

@jkotas jkotas merged commit 5c32341 into dotnet:master Sep 5, 2016
@benaadams benaadams deleted the throw-helper branch September 5, 2016 03:51
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants