Skip to content

Instantly share code, notes, and snippets.

@jimmysoho
Created March 15, 2011 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmysoho/870446 to your computer and use it in GitHub Desktop.
Save jimmysoho/870446 to your computer and use it in GitHub Desktop.
Testing Mail gem performance
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", "test.to@example.com")
mail.reply_to = address("test.reply_to", "test.replyo_to@example.com")
mail.return_path = address("test.return_path", "test.return_path@example.com")
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