Compare DataModel Reflection Decode Perfomance #1954
Replies: 3 comments
-
I don't think 4x performance discrepancy can be easily ignored. Also it would be nice to see the difference for each level. Something like [Benchmark]
public void DecodeFlatOriginal()
{
DataModelFlatOriginal temp = new DataModelFlatOriginal(encodedFlatData);
}
[Benchmark]
public void DecodeFlatNew()
{
DataModelFlatNew temp = new DataModelFlatNew(encodedFlatData);
}
[Benchmark]
public void DecodeNestedOriginal()
{
DataModelNestedOriginal temp = new DataModelNestedOriginal(encodedNestedData);
}
[Benchmark]
public void DecodeNestedNew()
{
DataModelNestedNew temp = new DataModelNestedNew(encodedNestedData);
} where public class DataModelFlatOriginal : DataModel { ... }
public class DataModelNestedOriginal : DataModel { ... }
public class DataModelFlatNew : DataModelNew { ... }
public class DataModelNestedNew : DataModelNew { ... } with |
Beta Was this translation helpful? Give feedback.
-
Here's some preliminary result using #1935 and generally how it is implemented in lib9c. You can see the code I used at https://gist.github.com/greymistcube/a1e63e5e1f0a160ed9ecf0697115be33. BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19044
11th Gen Intel Core i7-1185G7 3.00GHz, 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=3.1.413
[Host] : .NET Core 3.1.19 (CoreCLR 4.700.21.41101, CoreFX 4.700.21.41603), X64 RyuJIT
DefaultJob : .NET Core 3.1.19 (CoreCLR 4.700.21.41101, CoreFX 4.700.21.41603), X64 RyuJIT
|
Beta Was this translation helpful? Give feedback.
-
#1956 |
Beta Was this translation helpful? Give feedback.
-
#1940 I was trying to solve this issue
However, more conditional codes were required for null type
So I changed the decode code using Reflection
Reflection codes are heavy, so I need to check the performance difference
https://github.com/planetarium/libplanet/releases/tag/0.34.0 Code Bench result
Fix Reflection Decode Code Bench result
We need to discuss whether we can apply it.🤔
if we doesn't want to use a reflection. check above link or more conditional codes
https://discord.com/channels/928926944937013338/929910863123591199/974213134367739914
bench file
Reflection Decode
Beta Was this translation helpful? Give feedback.
All reactions