I recently installed iOS 4 on my iPhone 3G (the dev GM), and have been playing with it for the last week. As cool as the newer (available) features were, I was one of the many that had been experiencing a very slow OS. I finally couldn't take it anymore, I needed to speed the phone up!
After looking through the many posts detailing that there was in fact a speed issue across many of the phones, I started looking into why mine would fall into that category. No one seemed to have a specific source of the problem, but then it hit me: I remembered that I had jailbroken my phone last summer (which still had a visible remnant, the percentage indicator next to the battery). I had removed the jailbreak via a "restore from backup," since my phone had been extremely slow with it applied (however, even after restoring to an official firmware my phone seemed really slow).
I decided to lookup "iPhone 3G completely remove jailbreak," to see if I had performed a proper uninstalltion of the jailbreak. I couldn't find anything out of the ordinary, and it appeared that I had followed all of the correct procedures. Taking a leap, I decided to do a complete restore again, but this time without restoring from my backup (I still made one just in case); when I was prompted, I chose to setup a new phone. Guess what, it worked.
My phone runs great. Sure, there's the occasional lag with some apps, but that was there since day one (it is older hardware). Until my new iPhone 4 shows up in the mail, this will get me by just fine.
[update]Yes, I've tried the double-hard-reset method; however, I have found that doing a clean install and setting up a new phone worked the best for me. I have a feeling it's because of the jailbreak-leftovers.[/update]
[update]Looks like Apple is looking into the issue: Apple Looking into Slow iOS 4 Performance on iPhone 3G @ Ars Technica.[/update]
[update]Another tip: try disabling all of your Spotlight search-able content.[/update]