This appendix describes performance tuning of C program. See also the Oracle Developer Studio 12.5: Performance Analyzer.
libfast.a provides a fast but MT-Unsafe version of the standard C library functions malloc(), free(), realloc(), calloc(), valloc(), and memalign(). Because it is optimized for fast allocation in single-threaded applications, it may not be appropriate for applications requiring concurrent multi-threaded allocation or space-efficient memory reuse.
libfast_r.a is a MT-Safe version of libfast.a, though it does not support concurrent memory allocation by multiple threads. Only one thread at a time can allocate or free memory.
Both versions are supported on both 32-bit and 64-bit Oracle Solaris. They are supported on both SPARC and x86 platforms.
Freeing a block allocated by libfast malloc() does not make its storage available for allocating a new block of a different size. Because of this, libfast may not be suitable for use in multi-phase applications.
Use profiling to determine whether the routines in the following checklist are important to the performance of your application, then use this checklist to decide whether libfast.a or libfast_r.a benefits the performance.
Do use libfast.a or libfast_r.a if the performance of memory allocation is important, and the size of the most commonly allocated blocks equals or is slightly less than a power of two. The important routines are: malloc(), free(), and realloc().
Do not use libfast.a if the application is multithreaded. Use libfast_r.a instead.
When linking the application, add the option -lfast or -lfast_r to the cc command used at link time. The cc command links the routines in libfast.a or libfast_r.a ahead of their counterparts in the standard C library.