简体   繁体   中英

does .so size affect virtual function performance

Recently, I met a performance problem. In Vtune result, virtual function cost is always the no.1 cost, when I reduce the so size which from 48M to 37M, the performance seems better, raise up 3.9%.

I wanna know, does the .so size realy affect virtual function performance, if so, why? Thanks!

It is not purely size (though of course that affects paging after the program is loaded), but the number of adjustments the loader must make when loading a program. You can see that measured by setting the environment variable

LD_DEBUG=statistics

Virtual functions in particular will require a lot of adjustments during loading. For discussion on this,

I use the method from the article(blogs.oracle.com/ali/entry/the_cost_of_elf_symbol) which is provided by @ErikAlapää, use RTLD_LAZY instead of RTLD_NOW when dlopen the so. However, it seems nothing help. While I compile it with less objects, it becomes better. It seems paging cache does affect the process performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM