We should pass -O1 (the number is actually not important) to the linker for optimized builds if it's gnu ld or another linker that supports it. This flag causes the linker to perform some extra optimizations such as optimizing the hash table size for symbol lookups. gcc does _not_ pass -O through to the linker, so we'll need -Wl,-O1.
Somebody should make some performance tests after applying this patch. I know I asked for this change but the use of it in a project with many large hash tables and many DSOs might not be ideal. At least not with the current implementation of the optimization in the linker. I do have a refined version of the heuristic algorithm in my linker but this one isn't used yet. The characteristic of the current algorithm is to heavily perfer small tables. For large hash tables this means long hash chains and, compared to the default ld behavior which creates excessively large hash tables, slower lookups. But the whole thing might of course still be beneficial since the tables are significantly smaller which can help the data cache locality. So, I suggest running some benchmarks and weigh the results.
I'll run it through the pageload test and startup test.
*** Bug 99437 has been marked as a duplicate of this bug. ***
I'm not convinced that this causes a slowdown as mentioned in bug 99437. In my testing, the performance for both startup and pageload appeared to be reasonably close, probably within the margin of error of the test.
I also don't see any measurable change in footprint. I don't think we're going to get a win from this.