For performance reasons local DNS is hard to beat. If you don't need your own server for local name resolution, then second best choice IMO is to use DNS server provided by your ISP for a simple reason: theoretically you cannot do faster DNS resolution than through your ISP simply because requests to any other public DNS server (like 8.8.8.8 or 4.2.2.2) will go through your ISP servers anyways. (there is obviously possibility that DNS setup is misconfigured by your ISP, but I'll assume that it works as expected).
When any application tries to resolve a host name, at first the OS tries to resolve it by using internal cache, if the cache is not available, then it will contact the DNS server. By using dig you can bypass the OS's cache, directly query your or any random DNS server and see times that it takes to resolve using that DNS server.
For example, if I want to resolve google.com
using DNS server from my ISP:
> dig -4 -u +notcp google.com @76.14.0.8
...
google.com. 210 IN A 172.217.6.46
;; Query time: 9027 usec
...
It took 9027 microseconds to resolve it. If I run like 10 times I get consistent values within 9-10ms range. Now if I try to use google's DNS server:
> dig -4 -u +notcp google.com @76.14.0.8
...
google.com. 168 IN A 216.58.192.14
;; Query time: 30024 usec
...
It took 30024 microseconds. If I dig using their servers I get values that range from 20 to 60 ms, which is way worse that using DNS server provided by my local ISP. I'm physically located a couple of miles from google's headquaters, perhaps my local point that handles 8.8.8.8 is also not that far, but for somebody far away from 8.8.8.8 the difference will be much worse.
If you have a local DNS server (your router might have it), then:
> dig -4 -u +notcp google.com @192.168.0.1
...
google.com. 4 IN A 216.58.195.78
;; Query time: 9368 usec
...
it took 9368 microseconds, because my router didn't have cache for google.com and had to contact my ISP to resolve it. But if I run it second time now I always get cached results that are consistently less than 1ms:
> dig -4 -u +notcp google.com @192.168.0.1
...
google.com. 2 IN A 216.58.195.78
;; Query time: 493 usec
...
Hard to beat that kind of performance.
Overall, in the order of performance:
OS cache is the fastest (perhaps a microsecond or less to resolve
it), as no network requests are involved
Local DNS server with resolution times of 0.5-1ms
You ISP's DNS server (could be anything, let's assume 10ms)
Any other DNS server which should roughly add whatever extra time it takes to process the request from your ISP servers to the other DNS server, could be anything from 20 to 60ms at best.
So, when you would use 8.8.8.8, the 4th performance option over 2nd?
when your network is misconfigured or you don't know your DNS server's IP when you need to enter it you can simply use 8.8.8.8 as a quick fix.
use it as a secondary back up DNS server.
use it if your primary DNS server filters some domains (in some countries to block access to certain sites).