The design of library is is a compromise process. The ideal library should be short, fast, powerful, flexible, extensible, intuitive, universally applicable, with good support, without constraints, without errors. It's not there either. Libraries that are optimized for size and speed are generally not ported. Libraries with a large number of features are not intuitive. Libraries that do not have errors are limited in their scope of use. In the real world, you can't have everything, you have to pay.
Different designers give these conditions a different priority. They sacrificed different things in the design. So generally two libraries that provide the same functionality have completely different performance characteristics.
For example, consider the iostream and stdio libraries, which are both available for C + + programmers. The iostream library has several advantages over the stdio in C (see effective C + +). For example, it is type-safe (type-safe), and it is extensible. However, in terms of efficiency, the iostream library is always inferior to the stdio, because stdio produces an execution file that is smaller and executes faster than the iostream resulting execution file.
First, consider the speed of execution. One way to master the performance difference between iostream and Stdio is to run the benchmark program with both libraries. But you must remember that benchmark can also lie. It is not only difficult to come up with a set of data that represents the typical usage of a program or library, but it is no use, unless there is a reliable way to determine what characteristics you or your customers have. But benchmark can still provide some information when it's not a way to solve a problem, so it's silly to ignore them, although it's foolish to rely entirely on benchmark.
Let's test a simple benchmark program to test only the most basic I/O functionality. The program reads 30,000 floating-point numbers from the standard input and writes them in a fixed format to the standard output. Compile-time preprocessing symbols stdio decide whether to use Stdio or iostream. If you define this symbol, you are using stdio, otherwise you will use the iostream library.