Guid properties being boxed? #260
Replies: 1 comment 2 replies
-
At the moment, yes. See here: The reason is that reading generic types requires either GVMs (generic virtual methods) or a special-case method. In my benchmarks, I found that GVMs are actually slower than boxing, so I removed all GVMs and went with boxing. All of the primitive types, meaning types that may have special handling by the underlying format, have dedicated methods. The only workaround I can think of would be to implement Deserialize for the parent type manually, read out the primitive type directly (string, byte array, whatever) and then directly create the Guid inline. The broader feature that I could add would be adding Guid as a primitive type, which would give it a dedicated ISerialize/IDeserialize method. I'm just not sure it's worth it. As far as I can tell there are very few/no formats that have a dedicated Guid representation, so it would be somewhat awkward to make a primitive. I guess the question is: how much does the boxing matter? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Been doing some profiling and I noticed some boxing of
Guid
s occurring during serialization. Is boxing of value types expected? If so is there a workaround?Beta Was this translation helpful? Give feedback.
All reactions