swiftmailer/swiftmailer — pull request #280 by jimbojsb (2013-01-16 00:52:45+00:00)
Title: Fix performance when tokenizing massive headers

I made this update to fix a performance issue when using very large headers. The use case is SendGrid's bulk messaging API in which there can be many thousands of lines of JSON in one X-SMTPAPI header. array_merge() is known to be slow when dealing with arrays over about 100 items and being called repeatedly, because it's doing a key re-sort operation every time.

This change, in my 1000 item example, made the processing that happens inside ->send() go from 2 minutes to 2 seconds.