Yahoo is a known source of malware, for the most part directed at Windows users and which cannot affect a Mac. However Trojans are another matter, one example of which is the one called 'DNSChanger' or 'OSZ.RSPlug', which can alter the DNS settings of your network connection. This particular Trojan can be inadvertently installed if you have come across certain Quicktime movies where got a window stating that you have to download and install a particular codec in order to see the video.
If you have agreed to that installation, your system can be infected and your DNS settings altered, which results in your system using the wrong DNS servers, which can slow web surfing to a crawl.
This can be fixed by downloading and running a freeware utility called DNSChanger Removal Tool which you can download from here:
http://www.versiontracker.com/dyn/moreinfo/macosx/33696
Once you have run that utility you have to re-boot your Mac, then reset Safari, and re-enter your DNS settings in System Preferences/Network.