ConradIrwin / em-imap

An event machine based IMAP client
MIT License
69 stars 31 forks source link

Improve string handling when receiving data #10

Closed ksnyder closed 11 years ago

ksnyder commented 11 years ago

This change reduced fetching a 24Mb email from Gmail from about 10 minutes to 4 seconds. There may be further optimizations in this method, such as this loop:

while eol && @buffer...

But we're not seeing literals coming with the chunks on large emails.

ConradIrwin commented 11 years ago

@ksnyder Nice, thanks!

ConradIrwin commented 11 years ago

Released as v0.4.1.

ConradIrwin commented 11 years ago

(Oh, also it turns out that the @buffer[0, eol] thing is actually not as expensive as I thought — ruby uses Copy-on-write for string slices by default, and we never write to the slice.)