Created
March 15, 2011 08:10
-
-
Save jimmysoho/870446 to your computer and use it in GitHub Desktop.
Testing Mail gem performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def address(display_name, email_address) | |
address = Mail::Address.new | |
address.display_name = display_name | |
address.address = email_address | |
address | |
end | |
begin | |
n = 1000 | |
startTime = Time.now | |
(1..n).each do |_| | |
mail = Mail.new | |
mail.to = address("test.to", "[email protected]") | |
mail.reply_to = address("test.reply_to", "[email protected]") | |
mail.return_path = address("test.return_path", "[email protected]") | |
mail.subject = "foo" | |
mail.body = "foo" | |
end | |
totalTime = Time.now - startTime | |
ms = (totalTime / n * 1000) | |
puts "Total: #{totalTime}\n#{ms}ms / email" | |
end ; :ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment