Merge pull request #7346 from Bond-009/guid

Optimize Guid comparisons
This commit is contained in:
Claus Vium
2022-03-11 08:15:12 +01:00
committed by GitHub
66 changed files with 355 additions and 326 deletions

View File

@@ -16,14 +16,15 @@ namespace Jellyfin.Extensions.Json.Converters
/// <inheritdoc />
public override void Write(Utf8JsonWriter writer, Guid? value, JsonSerializerOptions options)
{
if (value == Guid.Empty)
// null got handled higher up the call stack
var val = value!.Value;
if (val.Equals(default))
{
writer.WriteNullValue();
}
else
{
// null got handled higher up the call stack
JsonGuidConverter.WriteInternal(writer, value!.Value);
JsonGuidConverter.WriteInternal(writer, val);
}
}
}