Why is the startup of an App on linux slower when using shared libs?

后端 未结 6 1872
执笔经年
执笔经年 2021-01-23 05:11

On the embedded device I\'m working on, the startup time is an important issue. The whole application consists of several executables that use a set of libraries. Because space

6条回答
  •  一向
    一向 (楼主)
    2021-01-23 06:14

    This is a fine example of the classic tradeoff of speed and space.

    You can statically link all your executables so that they are faster but then they will take more space

    OR

    You can have shared libraries that take less space but also more time to load.

    So decide what you want to sacrifice.

    There are many factors for this difference (OS, compiler e.t.c) but a good list of reasons can be found here. Basically shared libraries were created for space reasons and much of the "magic" involved to make them work takes a performance hit.

    (As a historical note the original Netscape navigator on Linux/Unix was a statically linked big fat executable).

提交回复
热议问题