dmo.ca/ tag/ memory

rjbs has been trying to improve Email::Simple's memory consumption, so I figured I'd give his test a try on MIME::Parser, just for the heck of it.

It's not a very good test for MIME::Parser, because Email::Simple doesn't itself do most of the stuff MIME::Parser does, but it's something.

Given the numbers he posted, for Email::Simple, I expected MIME::Parser to be much worse, but instead, for an 8MB message with 50 headers I get:

$ perl ./readmail-mimetools big.msg
just started                : 1556  3384
after require File::Slurp   : 2564  4180
after slurping              : 18204 19812
after require MIME::Parser  : 21928 23460
after construction          : 37684 39236

So... the code over head for MIME::Parser is about 3.7MB, and we take just under 2x the message size for internal representation.

Trying again, with MIME::Parser's tmp_to_core and output_to_core turned off (this makes it litter your filesystem with temp files named "msg-22195-1.txt" for each MIME body) it's a bit better:

$ perl ./readmail-mimetools-noncore big.msg
just started                : 1560  3384
after require File::Slurp   : 2564  4180
after slurping              : 18204 19812
after require MIME::Parser  : 21928 23460
after construction          : 29832 31412

So, what does this prove? Well, MIME-tools doesn't suck as bad as I thought. That's about it.

Posted Sat 16 May 2009 01:45:14 AM UTC Tags: memory