This Null NodeID PR didn't have the issue that the socket->stream change had. It also aligns compliance to OPC-UA spec better, so would be good to get in.
This introduces a Unit Test to prove the current deficiency, and to validate the change corrects the issue.
Have also added a Benchmark project, which has been used to investigate allocation sizes/performance of the NodeId type.
Have consolidated String/ByteArray(Guid/Opaque) reference type to a common 'object' field, but left accessor properties for the Byte/String types. I think the boxing/unboxing required for the NumericIdentifier would limit any benefit in doing similar with this type.
Also changed the enum base type for the NodeIdNetType to byte.
The combination of these took NodeId from 56 bytes down to 40bytes, and allocation of 1Million NodeIds from 74ms down to 55ms.
This Null NodeID PR didn't have the issue that the socket->stream change had. It also aligns compliance to OPC-UA spec better, so would be good to get in.
This introduces a Unit Test to prove the current deficiency, and to validate the change corrects the issue.
Have also added a Benchmark project, which has been used to investigate allocation sizes/performance of the NodeId type.
Have consolidated String/ByteArray(Guid/Opaque) reference type to a common 'object' field, but left accessor properties for the Byte/String types. I think the boxing/unboxing required for the NumericIdentifier would limit any benefit in doing similar with this type.
Also changed the enum base type for the NodeIdNetType to byte.
The combination of these took NodeId from 56 bytes down to 40bytes, and allocation of 1Million NodeIds from 74ms down to 55ms.
Changed the string comparison for NodeId equivalency to align with Microsoft best-practises https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings
Benchmark results, before robust null checks: |------------------ |--------------:|--------------:|--------------:|------------:| | NodeIdEquivalency | 8.142 us | 0.0917 us | 0.0766 us | 80.91 KB | | NodeIdAllocations | 76,750.335 us | 1,395.5669 us | 1,237.1337 us | 46875.56 KB |