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
Increased object allocations when using Mail::Address
#1215
Comments
Nice catch @tgxworld, thank you. Let's investigate. /cc @SamSaffron |
@jeremy I spent some time investigating this and was profiling against Mail - master fbc5d91
I did a bisect and found that this commit is required to reduce the number of allocations. I don't really understand that commit enough to know why it would help but I thought it might point you in the right direction. |
Thanks @tgxworld! That's a good start. |
most of allocations come from the first load because parsers are lazily loaded
2.7.0
2.6.6
2.7.0 + recompiled ragel with -F1 ( https://www.systutorials.com/docs/linux/man/1-ragel/ ) + minor perf tweaks
memory allocation with -F1 option is much lower even then 2.6.6, but it's also 5 times slower. Mail gem use -T1 option: so it's more performance for a cost of more memory consumption. Well it's only 10MB for lookup tables (it isn't allocated over and over again). I don't think we can improve it any better. btw. Ragel dropped support for Ruby http://www.colm.net/news/2016/07/31/ragel-target-langs.html |
Apparently Ruby support is coming back in v7 😅 |
Closing this as more fruitful discussions are taking place in #1343 |
We noticed an increase in the number of
heap_live_slots
on our Unicorn web workers after upgrading to2.7.0
and was able to trace it down to the use ofMail::Address.new("someemail@example.com")
in our code base. I wrote a simple script that profilesMail::Address.new
and noticed that2.7.0
is allocating almost 1.7x more objects than2.6.6
Script
Mail 2.6.6
Mail 2.7.0
The text was updated successfully, but these errors were encountered: