Some parts of the C library cannot be optimized for speed, even though doing so would benefit most applications. Some examples:
Integer arithmetic routines—Current SPARC V8 processors support integer multiplication and division instructions. However, if standard C library routines were to use these instructions, programs running on V7 SPARC processors would either run slowly due to kernel emulation overhead, or might break altogether. Hence, integer multiplication and division instructions cannot be used in the standard C library routines.
Doubleword memory access—Block copy and move routines, such as memmove() and bcopy(), could run considerably faster if they used SPARC doubleword load and store instructions (ldd and std). Some memory-mapped devices, such as frame buffers, do not support 64-bit access; nevertheless, these devices are expected to work correctly with memmove() and bcopy(). Hence, ldd and std cannot be used in the standard C library routines.
Memory allocation algorithms—The C library routines malloc() and free() are typically implemented as a compromise between speed, space, and insensitivity to coding errors in old UNIX programs. Memory allocators based on “buddy system” algorithms typically run faster than the standard library version, but tend to use more space.