[
https://issues.apache.org/jira/browse/IGNITE-20523?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Tupitsyn updated IGNITE-20523:
------------------------------------
Description:
IGNITE-20479 replaced custom null checks with standard
*ArgumentNullException.ThrowIfNull*. However, *ThrowIfNull* takes *object*,
which involves boxing for value types. Therefore we do heap allocations just to
validate arguments in some cases, such as generic record/key/value validation
in *KeyValueView* and *RecordView*. Bring back the custom generic validation
method to fix this.
Also, *ToKv* method validates the wrong thing twice:
{code}
private static KvPair<TK, TV> ToKv(KeyValuePair<TK, TV> x)
{
ArgumentNullException.ThrowIfNull(x);
ArgumentNullException.ThrowIfNull(x);
return new(x.Key, x.Value);
}
{code}
was:
IGNITE-20479 replaced custom null checks with standard
*ArgumentNullException.ThrowIfNull*. However, *ThrowIfNull* takes *object*,
which involves boxing for value types. Therefore we do heap allocations just to
validate arguments in some cases, such as generic record/key/value validation
in *KeyValueView* and *RecordView*. Bring back the custom generic validation
method to fix this.
Also, *ToKv* method validates the wrong thing twice:
{code}
ArgumentNullException.ThrowIfNull(x);
ArgumentNullException.ThrowIfNull(x);
{code}
> .NET: Thin 3.0: ArgumentNullException.ThrowIfNull allocates on value types
> --------------------------------------------------------------------------
>
> Key: IGNITE-20523
> URL: https://issues.apache.org/jira/browse/IGNITE-20523
> Project: Ignite
> Issue Type: Improvement
> Components: platforms, thin client
> Affects Versions: 3.0.0-beta1
> Reporter: Pavel Tupitsyn
> Assignee: Pavel Tupitsyn
> Priority: Minor
> Labels: .NET, ignite-3
> Fix For: 3.0.0-beta2
>
>
> IGNITE-20479 replaced custom null checks with standard
> *ArgumentNullException.ThrowIfNull*. However, *ThrowIfNull* takes *object*,
> which involves boxing for value types. Therefore we do heap allocations just
> to validate arguments in some cases, such as generic record/key/value
> validation in *KeyValueView* and *RecordView*. Bring back the custom generic
> validation method to fix this.
> Also, *ToKv* method validates the wrong thing twice:
> {code}
> private static KvPair<TK, TV> ToKv(KeyValuePair<TK, TV> x)
> {
> ArgumentNullException.ThrowIfNull(x);
> ArgumentNullException.ThrowIfNull(x);
> return new(x.Key, x.Value);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)