Dynamic linking optimizations

Ian Lance Taylor iant@google.com
Tue Mar 3 18:22:00 GMT 2009


John Moser <nigelenki@comcast.net> writes:

>> Character comparisons are fast.  It doesn't help to minimize them if it
>> makes each operation cost more on average.
>
> Well, the "operations" would  be following a branch, which involves
> jumping by a computed offset and reading in a byte (to use as an index).

Yes.  On a modern processor, a character comparison is much faster than
a mispredicted branch (I would guess that the memory cache will hit
about as often for both algorithms).  The branches in your algorithm
would be difficult for the processor to predict correctly, so I think
one must assume that half of them will be mispredicted.

Ian



More information about the Binutils mailing list