Remove redundant calls of toString()

Andrew Haley aph at redhat.com
Tue Apr 29 09:40:44 UTC 2014


On 04/28/2014 07:57 AM, David Holmes wrote:
> On 28/04/2014 1:05 PM, Otávio Gonçalves de Santana wrote:
>> In my opinion not, because Objects.requireNonNull is more readable than
>> just string.toString. This way is more understandable which field is
>> required and doesn't impact on performance.
> 
> An invocation of requireNonNull is potentially more expensive than the 
> implicit null check that happens with foo.toString().

It's also potentially cheaper: a cbnz versus a fetch from memory with a
few cycles pipeline delay.

Andrew.




More information about the core-libs-dev mailing list