Skip to content

Commit

Permalink
reproduce nullable boxing issue; to be run using the benchmark added in
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis committed Aug 14, 2021
1 parent b2fc310 commit a44c0ee
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,5 @@ internal override void WriteNumberWithCustomHandling(Utf8JsonWriter writer, T? v
_converter.WriteNumberWithCustomHandling(writer, value.Value, handling);
}
}

internal override bool IsNull(in T? value) => !value.HasValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ internal override sealed bool TryReadAsObject(ref Utf8JsonReader reader, JsonSer
/// <summary>
/// Overridden by the nullable converter to prevent boxing of values by the JIT.
/// </summary>
internal virtual bool IsNull(in T value) => value == null;
private bool IsNull(in T value) => value == null;

internal bool TryWrite(Utf8JsonWriter writer, in T value, JsonSerializerOptions options, ref WriteStack state)
{
Expand Down

0 comments on commit a44c0ee

Please sign in to comment.