[PATCH] D37517: [ELF] - Report orphan sections if -verbose given.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 02:10:55 PDT 2017


grimar added a comment.

In https://reviews.llvm.org/D37517#874133, @ruiu wrote:

> `log()` is a regular function, so its argument is evaluated first and then its value is passed to `log()`. That means `toString(S)` is always executed even if it's not going to be written. Is it slow? (I do not request you update this patch, but I'm wondering whether it's negligible or not.)


I think answer is "it depends". `addOrphanSections` called only when `Script->Opt.HasSections` condition is true. And I think if script has SECTIONS, amount of orphan sections in compare with
amount of explicitly listed should be much lower.

I performed a quck test which tries to simulate the situation (https://ideone.com/p07NYi). It calls some method `log()` which do nothing with random string argument million of times.
Like if we would have script with million of orphans. It takes 80 milliseconds in total. That probably can be considered as the approximation of worst possible scenario ?


https://reviews.llvm.org/D37517





More information about the llvm-commits mailing list