How To Write Shared Libraries(18)

1.6 Summary of the Costs of ELF(2)

Length of Symbol Strings
Long symbol lengths cause often unnecessary costs. A successful lookup of a symbol must match the whole string and comparing dozens or hundreds of characters takes time. Unsuccessful lookups suffer if common prefixes are long as in the new C++ mangling scheme. In any case do long symbol names cause large string tables which must be present at run-time and thereby is adding costs in load time and in use of address space which is an issue for 32-bit machines.
语法标签长度导致不必要的消耗。一次成功的查找过程必须匹配完整的字符串并且比较几十上百个字符的时间。不成功的查找比较c++通用的前缀语法项。
在任何情况下,长符号名会导致在运行时必须存在的大型字符串表,从而增加加载时间和地址空间的使用成本,这是32位机器的一个问题。(有道翻译)

Number of Relocations
Processing relocations constitute the majority of work during start and therefore any reduction is directly noticeable.
重定位时由开始的所有内容组成,所以任何减少都是有效的。

Kind of Relocations
The kind of relocations which are needed is important, too, since processing a rela- tive relocation is much less expensive than a normal relocation. Also, relocations against text segments must be avoided.
重定位的种类也非常重要,处理一个相关的重定位少于普通定位过程。重定位代码段必须少用。

Placement of Code and Data
All executable code should be placed in read-only memory and the compiler normally makes sure this is done correctly. When creating data objects it is mostly up to the user to make sure it is placed in the correct segment. Ideally data is also read-only but this works only for constants. The second best choice is a zero- initialized variable which does not have to be initialized from file content. The rest has to go into the data segment.
所有可执行的代码必须处理只读内存和编译保证正确处理。当创建数据对象通常时有用户保证使用正确。理想的数据也是只读的,但仅限于常量。另一个好的选择时初始化为0的数据,不需要存放在文件中。其他的需要添加到数据段。

In the following we will not cover the first two points given here. It is up to the developer of the DSO to decide about this. There are no small additional changes to make the DSO behave better, these are fundamental design decisions. We have voiced an opinion here, whether it is has any effect remains to be seen.
后续内容不会考虑开始的两个内容了。️开发者决定这些内容。没有小的额外变化保证DSO更好,这就是基本的设计决策。这里有选项,但是否有效果仍需观察。

你可能感兴趣的:(How To Write Shared Libraries(18))