Use script/performance/benchmarker:
script/performance/benchmarker 2000 "User.find_by_name('Joe').id" "User.first(:conditions => {:name => 'Joe'}, :select => 'id').id"
On my dev machine, this reports:
user system total real
#1 1.110000 0.070000 1.180000 ( 1.500366)
#2 0.800000 0.050000 0.850000 ( 1.078444)
Thus, the 2nd method appears to be faster, since it has less work to do. Of course, you should benchmark this on your production machine, using the production environment:
RAILS_ENV=production script/performance/benchmarker 2000 "User.find_by_name('Joe').id" "User.first(:conditions => {:name => 'Joe'}, :select => 'id').id"
It might change conditions a bit for you.