[
https://issues.apache.org/jira/browse/IGNITE-12699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17229117#comment-17229117
]
Pavel Tupitsyn edited comment on IGNITE-12699 at 11/10/20, 10:37 AM:
---------------------------------------------------------------------
1. Removing TypeCasters complicates the logic with signed/unsigned type pairs
like {{int/uint}}, {{byte/sbyte}}. TypeCaster can convert {{byte}} to
{{sbyte}}, while {{(T)(object)val}}-style cast can not. This is not hard to
fix, but risky for the backwards compatibility.
2. Performance difference for a real-world use case (e.g.
BinaryObject.GetField) is barely observable
Given the above, I don't think we should do this in 2.x release: does not make
sense to risk introducing a subtle bug for no perf benefit.
This should be done for 3.0 to streamline the code. Serialization logic will
probably change in 3.0 anyway.
Moved to 3.0, stopping for now.
was (Author: ptupitsyn):
1. Removing TypeCasters complicates the logic with signed/unsigned type pairs
like {{int/uint}}, {{byte/sbyte}}. TypeCaster can convert {{byte}} to
{{sbyte}}, while {{(T)(object)val}}-style cast can not. This is not hard to
fix, but risky for the backwards compatibility.
2. Performance difference for a real-world use case (e.g.
BinaryObject.GetField) is barely observable
Given the above, I don't think we should do this in 2.x release: does not make
sense to risk introducing a subtle bug for no perf benefit.
This should be done for 3.0 to streamline the code. Serialization logic will
probably change in 3.0 anyway.
> .NET: Remove TypeCaster
> -----------------------
>
> Key: IGNITE-12699
> URL: https://issues.apache.org/jira/browse/IGNITE-12699
> Project: Ignite
> Issue Type: Improvement
> Components: platforms
> Reporter: Pavel Tupitsyn
> Assignee: Pavel Tupitsyn
> Priority: Major
> Labels: .NET
> Fix For: 3.0
>
>
> TypeCaster class is used in Ignite.NET for non-boxing, faster casts.
> Benchmarks on .NET 4.0 displayed clear advantage of this solution.
> However, this is no longer true on .NET Core due to improvements in the
> framework:
> {code}
> | Method | Runtime | Mean | Error | StdDev |
> |----------- |-------------- |----------:|----------:|----------:|
> | TypeCaster | .NET Core 2.2 | 3.4615 ns | 0.0325 ns | 0.0304 ns |
> | ObjectCast | .NET Core 2.2 | 1.0936 ns | 0.0040 ns | 0.0036 ns |
> | UnsafeCast | .NET Core 2.2 | 4.1921 ns | 0.0125 ns | 0.0111 ns |
> | TypeCaster | .NET Core 3.1 | 1.5306 ns | 0.0042 ns | 0.0037 ns |
> | ObjectCast | .NET Core 3.1 | 0.0229 ns | 0.0029 ns | 0.0024 ns |
> | UnsafeCast | .NET Core 3.1 | 2.1868 ns | 0.0052 ns | 0.0043 ns |
> {code}
> (See benchmark code in https://github.com/ptupitsyn/IgniteNetBenchmarks)
> Remove TypeCaster class and use regular cast instead.
> Run Ignite deserialization benchmarks to confirm the effect.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)