On a script, you can use Microsoft's excellent Web Application Stress Tester tool, available for free at http://webtool.rte.microsoft.com/ , or Apache's also excellent and free 'ab' (Apache Bench) located in /usr/local/apache/bin/ab . They take a URL and hit it X number of times and give you info on how long it took, etc.
Benchmarking a statement is a bit more tricky. I don't know of anything that can do that.
Bookmarks