Guidelines for Improving the Runtime Performance of the OSS ASN.1 Tools for C++:
- Use the TOED (Time-Optimized Encoder/Decoder) runtime instead of the SOED.
- Do not set the DEBUGPDU flag before calling the encoder/decoder. This will disable time-consuming tracing activity during encoding/decoding operations.
- Specify the -minimize ASN.1 compiler command line option when compiling your ASN.1 syntax. This will probably lead to a smaller .cpp file and will result in only crucial constraint checking being done on values which are being encoded/decoded. Alternatively, specify the NOCONSTRAIN flag before calling the encoder/decoder, thereby disabling runtime constraint checking while retaining the ability to later enable it if the need arises.
- Do not specify the OSS_TRAPPING flag before calling the encoder/decoder. This flag enables the trapping of memory violations and the construction of an error message that details which field of the PDU was being processed when the memory violation occurred. If your application is fully tested, you have every reason to not specify OSS_TRAPPING. For versions prior to 4.1, specify the NOTRAPPING flag before calling the encoder/decoder.
- Use the OSS ASN.1/C++ Memory Pools API that provides optimized dynamic memory management. The sample that demonstrates The Memory Pools API can be found in the samples/advanced/memory_pool subdirectory of the shipment.
- If you use the OSS TOED library, first review the C++ Compiler Macros to Optimize Size and Speed when Using the TOED section, and tune your application to achieve better performance by setting some of the listed macros.
- Use ownership-transferring functions to avoid excessive copying of large memory blocks. Use the Use the OSS.POINTER directive to additionally generate ownership-transferring functions for components of constructed types.
- C++ compile the generated code with optimization flags.
Note: if runtime performance is very important for your application, you should consider using the OSS ASN.1 Tools for C, which are optimized for high speed and small memory footprint.
The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.