PERF: Reduce allocated memory when generating mailing list email.

Before: 10590714 bytes
After: 5303394 bytes
This commit is contained in:
Guo Xiang Tan 2017-05-03 12:08:14 +08:00
parent 8d04afc01b
commit 90cd35c496

View File

@ -228,7 +228,7 @@ module Email
@fragment.css('[href]').each do |element|
href = element['href']
if href =~ /^\/\/#{host}/
if href.start_with?("\/\/#{host}")
element['href'] = "#{scheme}:#{href}"
end
end
@ -260,8 +260,8 @@ module Email
def strip_classes_and_ids
@fragment.css('*').each do |element|
element.delete('class')
element.delete('id')
element.delete('class'.freeze)
element.delete('id'.freeze)
end
end