Google has a better track record of security with Yahoo having one of the largest data breaches back in 2016 on 500 million accounts. Plus, Gmail does a better job of forcing you into using stronger passwords, setting up two-step authentication, and has a session expiry to prevent you from getting hacked.