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 ASN.1 compiler command line option -minimize 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 OSS ASN.1/C++ Memory Pools API that provides optimized dynamic memory management. Please find the details in the section entitled "184.108.40.206 Memory pools" in the OSS ASN.1/C++ Runtime API Reference Manual (September 2010 Edition). 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, please review the section entitled "4.3 List of macros affecting the compilation of TOED code files" in the OSS ASN.1/C++ Runtime API Reference Manual (September 2010 Edition), 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 OSS.POINTER directive to additionally generate ownership-transferring functions for components of constructed types. Please review the section entitled "3.7.17 OSS.POINTER / OSS.NOPOINTER" in the OSS ASN.1 Compiler for C++ Reference Manual (September 2010 Edition) for details.
- 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.