Skip to content

improve performance of Message#find_attachment #1229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ahorek
Copy link
Contributor

@ahorek ahorek commented Apr 18, 2018

this is a rebased version of #825

benchmark

require 'mail'
require 'benchmark/ips'
part = Mail::Part.new.tap do |part|
  part.content_disposition = 'attachment; filename="test.asc"'
  part.content_type  = 'application/pgp-signature'
end

Benchmark.ips do |x|
  x.report('test find_attachment') { part.send(:find_attachment) }
end

result

patch:     25437.0 i/s
master:    13268.2 i/s - 1.92x  slower

@ahorek ahorek force-pushed the speedup_find_attachment branch from 8461823 to cf3a2be Compare December 3, 2022 10:26
@ahorek
Copy link
Contributor Author

ahorek commented Dec 3, 2022

rebased

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant