Will it run faster? My bet would be a
no. Why? Imagine something as simple as:
find / -type f -exec grep "widget" {} \; -print
Every time these programs are called, the entire symbol table will be built, in theory, even for those symbols not directly invoked, like most of grep's functionality. That's wasted milliseconds for each iteration. Does grep use shared libraries? I'm sure it does.
So, with respect, I think your question is the wrong question to ask, because I am not sure speed is the end result of any of this.
For example, each architecture will (most likely?) have its own way of processing the PLT (Procedure link table) into the GOT (Global offset table), thereby meaning one architecture might take X instructions, and another X+1 or even X+n.
Now, this area of expertise (CPU architecture) is not mine, but a quick look at assembly on AMD64:
Write a program that access an
extern int:
Code:
movq <<variable>>@GOTPCREL(%rip), %rax
movl (%rax), %eax
popq %rbp
.cfi_def_cfa %rsp, 8
Where <<variable>> is an external variable in the program. So, that's a few instructions.
Now, look at a call to an external (by inference, shared) object/function:
Code:
callq <<external_call>>@PLT
addl $1, %eax
popq %rbp
.cfi_def_cfa %rsp, 8
retq
Where <<external_call>> is an external function.
So, that's a few. Yes, a CPU runs damn fast, but it adds up if you're doing it all up front compared to only when needed.
It also depends on the number of external variables being referenced AND the number of shared functions. I mean, how do you produce a metric for this, short of going through the entire kernel (static linked) and userland (dynamic except
/rescue programs)?
Personally, I can see some good enabling this if you're running tests on FreeBSD, but otherwise, I just don't see how it could speed up the OS (and frankly, if it did wouldn't you think it would be enabled by default?)
But as
ralphbsz says, the only definitive way to determine speed is to enable it and test.
I'm sorry I can't give you a black-and-white YES or NO. I can give you a "I don't know, but my gut says no".
P.S. Edit:
I just did a check on an ArmV7 external variable call:
Code:
adrp x0, :got:<<external>>
ldr x0, [x0, #:got_lo12:<<external>>]
ldr w0, [x0]
ret
.cfi_endproc
ldr is a quite costly instruction, much more than mov. So, again, architecture matters.