Usually, if a user wants to copy an ASN.1 structure, the user first encodes the source structure and then decodes it into the destination structure. This works well, though is not really performant.
This PR introduces asn_copy() to speed up structure deep-copying without the encoding/decoding overhead.
A benchmark of copying a zero-initialized ETSI ITS CAM (definition) 1000000 times, with some fields set to 1 to pass constraint checks. Encoding/decoding roundtrip-based copy results are also shown.
Cloning CAM 1000000 times
Copy in 0.263973 s
COER in 3.683888 s
BER in 14.686351 s
UPER in 3.921389 s
JERM in 10.551459 s
CXER in 14.745492 s
Usually, if a user wants to copy an ASN.1 structure, the user first encodes the source structure and then decodes it into the destination structure. This works well, though is not really performant.
This PR introduces
asn_copy()
to speed up structure deep-copying without the encoding/decoding overhead.A benchmark of copying a zero-initialized ETSI ITS CAM (definition) 1000000 times, with some fields set to
1
to pass constraint checks. Encoding/decoding roundtrip-based copy results are also shown.